Changing PHP Settings

PHP settings are controlled using php.ini files. When you deploy a server via SpinupWP, a default php.ini file is created with sensible default values. However, you are free to update these values.

Each version of PHP has its own php.ini file, which is located here:

/etc/php/{PHP_VERSION}/fpm/php.ini

Any changes made to this file will impact all sites on the server running that version of PHP, unless they are overridden by per-site settings. After you’ve made the desired configuration changes, you must reload PHP for the changes to take effect.

sudo service php{PHP_VERSION}-fpm reload

Per-Site Settings

Each site deployed via SpinupWP is created with it’s own PHP pool. This means that you can override the settings in your php.ini file on a per-site basis. Any value in your php.ini file can be overridden by adding the value to your /etc/php/{PHP_VERSION}/fpm/pool.d/{SITE_USER}.conf file, like so:

php_value[upload_max_filesize] = 64M
php_value[post_max_size] = 64M

php_value should not be used to set boolean values. Instead, use php_flag:

php_flag[display_errors] = Off

It’s also possible to prevent config values from being overridden by ini_set by using php_admin_value and php_admin_flag.

php_admin_value[upload_max_filesize] = 64M
php_admin_value[post_max_size] = 64M
php_admin_flag[display_errors] = Off

Remember to reload PHP when making any changes to your PHP pool config files.

sudo service php{PHP_VERSION}-fpm reload

Array Based Syntax

Note that per-site configuration files use array based syntax. This is a slightly different syntax than found in default php.ini files.

Setting the upload_max_file_size in a per-site file:

php_value[upload_max_filesize] = 64M

Setting the upload_max_file_size in a default php.ini file:

upload_max_filesize = 64M