Opalstack's PHP setup is configured to meet the requirements for most PHP applications, but sometimes you might be working with a bleeding-edge application (or maybe a really old one) that needs a PHP version or configuration that's different than what Opalstack provides.
In those cases, you can build your own version of PHP from source and use that to serve your application.
As an example, there are some applications that need to use a newer version of the popular
curl libarary. These are the steps to install a private PHP-FPM stack with a custom-built version of PHP with an up-to-date version of curl.
Create a "Nginx Proxy Port" app in your Opalstack dashboard and make a note of the app's name and port assignment.
SSH to your Opalstack server as the new app's shell user.
Run the following commands to install curl and PHP:
mkdir -p ~/src ~/tmp ~/opt
tar xf curl-7.81.0.tar.xz
./configure --prefix=$HOME/opt --with-openssl
make && make install
tar xf php-8.1.2.tar.xz
./configure --prefix=$HOME/opt --with-pdo-mysql -with-pdo-pgsql=/usr/pgsql-11 --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-mbstring --enable-soap --with-curl=$HOME/opt --with-gettext --with-gmp --with-iconv --with-kerberos --with-mhash --with-mysqli --with-openssl --with-pgsql=/usr/pgsql-11 --with-xsl --with-zlib-dir --without-pear --enable-sockets --enable-intl --with-mysql-sock=/var/lib/mysql/mysql.sock --enable-fpm --with-zlib
make && make install
Install a PHP-FPM stack into the app you created in step 1. Instructions for installing the PHP-FPM stack are available at: HOWTO run a private PHP-FPM stack on Nginx or Apache on Opalstack - Opalstack Community Forum
Configure the PHP-FPM stack to use your custom PHP by running the following commands as your stack's shell user:
ln -f -s $HOME/opt/sbin/php-fpm ./
- Edit the stack's
bin/start script to insert the following line near the top, just below
- Restart the stack to pick up the changes by running the following command:
- Route the stack app to whatever site at https://my.opalstack.com/domains/.