Installing a custom version of PHP on Dreamhost
Dreamhost does not support php-fpm on it's VPS server so I put together q guide on how to get it to work if you ever need to. It seems to be a better way than the default CGI version.
Install dependencies first
Install all the libs php will need. They all need to be made and deployed. I like to add webp, zlib, and onigurma.
wget https://github.com/kkos/oniguruma/releases/download/v6.9.8/onig-6.9.8.tar.gz
tar -zxvf onig-6.9.8.tar.gz
./configure --prefix=$HOME/opt/onig
make
make install
wget https://github.com/webmproject/libwebp/archive/refs/heads/main.zip
unzip main.zip
./autogen.sh 2>/dev/null || true
./configure --prefix=$HOME/opt/libwebp
wget https://libzip.org/download/libzip-1.9.2.tar.gz
wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.tar.gz
cd libzip-1.9.2
mkdir build
../../cmake-3.28.3-linux-x86_64/bin/cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/opt/libzip
make
make install
Add the new libs to your patch for PHP
PHP will need to access these libs for some of the config features.
export PKG_CONFIG_PATH=$HOME/opt/onig/lib/pkgconfig:$HOME/opt/libzip/lib/pkgconfig:$HOME/opt/libwebp/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$HOME/opt/onig/lib:$HOME/opt/libzip/lib:$HOME/opt/libwebp/lib:$LD_LIBRARY_PATH
Install php
Now we finally get to make PHP and install it. PHP does take some time tp make, about 10-15 minutes so don't be alarmed.
wget https://www.php.net/distributions/php-8.4.1.tar.gz
tar -zxvf php-8.4.1.tar.gz
./configure \
--prefix=$HOME/opt/php8.4.1 \
--enable-fpm \
--with-zlib \
--with-curl \
--with-openssl \
--with-pdo-mysql \
--with-mysqli \
--enable-mbstring \
--enable-intl \
--enable-simplexml \
--enable-gd \
--with-webp \
--with-jpeg \
--enable-opcache \
--with-zip
make
make install
Now you can go to your newly created php instance create a few settings files, and run the server. Use the nodemonize directive at first for debugging.
./php-fpm --nodaemonize