← ServerPilot Docs

Customizing the PHP Configuration

Careful! We can't provide support for customizations or for any errors, downtime, or vulnerabilities you introduce through customizations.

Unless you're absolutely sure about what you're doing, you should stop now!
The supported way to change an app's PHP settings is through .user.ini files. This is a safe way to change settings.

Most commonly, customizing the PHP configuration of individual apps is what you're trying to do. In a few cases, you may be looking to make global customizations.

See the PECL installation instructions for instructions on installing PHP extensions, such as APC.

App Customizations

Each app has it's own PHP FPM process pool whose default PHP settings can be customized by adding files ending in .conf to the directory:

/etc/phpX.Y-sp/fpm-pools.d/APPNAME.d

To change the default PHP setting for session.gc_maxlifetime to 1 day, create the file:

/etc/phpX.Y-sp/fpm-pools.d/APPNAME.d/settings.conf

with the following contents:

php_value[session.gc_maxlifetime] = 86400

Then, restart PHP with by running the following command as root:

sudo service phpX.Y-fpm-sp restart

Global Customizations

If you need to customize the global PHP configuration, you can add configuration files in the following directory:

/etc/phpX.Y-sp/conf.d

Note that files in this directory must end with the file extension .ini rather than .conf.

Next, restart PHP with this command run as root:

sudo service phpX.Y-fpm-sp restart

Launch your first site in 5 minutes