How do I get a PHP configuration value or version changed?

Problem Description

  • You wish to change a PHP configuration value
  • You wish to change the PHP version
  • You receive an error like one of the following:
    • The uploaded file exceeds the upload_max_filesize directive in php.ini
    • Allowed memory size of 67108864 bytes exhausted 

By default all of our servers are configured to run PHP via FastCGI or with PHP-FPM. This means that setting PHP configuration values via the .htaccess file does not work. This is because .htaccess is an apache configuration file, but PHP is no longer running directly within the apache web server.

Solution

To change the PHP version or adjust a PHP configuration value, you can configure it within Plesk which will then configure PHP accordingly regardless of the run-mode (FastCGI, Apache Module, PHP-FPM). Here's how:

  1. Login to Plesk
  2. Choose the Websites & Domains tab.
  3. Find your domain in the list, then, if you don't see a "PHP Settings" button, click the little arrow at the bottom of its box (or Show More in Plesk 12+).
  4. Choose the PHP Settings button -- on this page you can change the most common PHP settings.
  5. Make the changes you need and choose the OK button when you're done. Examples:
    1. If you get an error while uploading files (likely about exceeding the upload_max_filesize directive), increase the upload_max_filesize value until you no longer get the error. You will also need to adjust the post_max_size limit to the same value. Typically 64M is sufficient for both.
    2. If you get an error about the allowed memory size being exhausted, increase the memory limit shown.
    3. If you do not see the directive you need to change, you may have an 'Additional Directives' box at the bottom of the page where you can enter it manually, for example: date.timezone = "America/Halifax"
    4. If you are changing your PHP version, we recommend selecting the latest version and testing the site out with that. Browse the site while monitoring the logs in Plesk to see if any critical errors appear. If not, then you're all set! If there are errors, you may need to drop the version down one and repeat that until the errors do not appear.

The changes may take at most 5 minutes to apply; in most cases they're instant.

Advanced Solution

If the PHP Setting you want to change is not available in the list of Plesk options, fear not! You can use a .user.ini file to manually override many PHP settings. Here's how:

  1. Login to Plesk
  2. Choose the Websites & Domains tab.
  3. Find your domain in the list, then, click the web root folder (or File Manager, and navigate to the web root folder)
  4. Edit your .user.ini file if one exists, or click "New" and "New File" - name it .user.ini (the .'s are important!!) 
  5. Enter the php configuration as if it was going into a PHP file. For example: date.timezone=America/Halifax

Once adjusted, the PHP-FPM Process should pick up the changes immediately (or within just a minute or two).

If you are on a managed server feel free to open a ticket and ask us to take care of this for you. Include the domain and php configuration values you wish to adjust and we will apply the configuration parameters accordingly.

Plesk VPS 

The following options are for those with their own VPS only.

instead of using the Additional Directives section in the Plesk GUI, you may alternatively edit /var/www/vhosts/system/<domain>/conf/php.ini and enter the same values there.

  • 4 Users Found This Useful