Changing PHP Settings

SpinupWP makes it very easy to switch the version of PHP that runs a site:

  • From a site’s dashboard, select PHP from the left menu.
  • Select your desired version of PHP from the drop-down menu.
  • Click Save

Select PHP version

If you select a version of PHP that has not been installed on the server, it will be installed.

Per-Site Settings

Each site deployed via SpinupWP is created with its own PHP pool. This means that you can change PHP settings on a per-site basis.

Common settings like memory limits, timeouts and worker management can be configured from the site’s PHP tab:

Configure PHP Settings

SpinupWP will automatically update your PHP pool with the new values and reload PHP-FPM for you.

For settings not available in the dashboard, start by connecting to your server using a sudo user, and then you can add values 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

Changes made to the PHP pool config will persist when changing PHP versions for a site.

Per-server Settings

You can also change the PHP settings using php.ini files. You will need to SSH into the server using a Sudo User to edit these 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

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