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

  • 5

Problem Description

Any one or multiple of the following are true:

  • You wish to change a PHP configuration value, upgrade or alter the PHP version, or increase PHP limits
  • You receive an error (likely while uploading files) about exceeding the upload_max_filesize directive like "The uploaded file exceeds the upload_max_filesize directive in php.ini". This means you need to increase the PHP upload_max_filesize configuration value. If that does not resolve the problem, you will also need to adjust the post_max_size limit to the same value. Typically 64M is sufficient for both.
  • You receive an error (often while saving a page) like "PHP Fatal error: Allowed memory size of 67108864 bytes exhausted." This means you need to increase the PHP memory_limit configuration value.
  • You receive an error while uploading a file: "The Link You Followed Has Expired." This means you need to increase the upload_max_filesize configuration value.

See the Problem Resolution below to learn how to make these changes.

Problem Resolution

You'll need to adjust a PHP configuration value to fix these kinds of errors. Google search results for some of these errors will tell you to edit these PHP configuration values using the .htaccess file, but setting PHP configuration values via the .htaccess file does not work with our systems. (This is because .htaccess is an apache configuration file, but PHP is no longer running directly within the apache web server on our systems for optimal performance).

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. Note: some of these settings are BOTH drop downs and user-enterable fields, so if the value you wish to use is larger than the options available in the drop down, simply enter the value you want (matching the format of what shows in the drop down). Example for memory_limit: 512M
  5. Make the changes you need and choose the OK button when you're done

Tips:

  • 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"
  • 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.
  • If you are changing your PHP version and you want a newer version of PHP that isn't in the drop down, please creating a ticket here to ask about it. If you're looking for an older version of PHP, we *might* have a server available with older versions, but this is not guaranteed due to the potential for unpatched security vulnerabilities in older PHP versions.
  • If you have Divi Builder installed and, after completing the change above, you still see errors in the logs about the memory limit being 256MB, despite it being changed to a higher value, this is Divi's fault. We don't know why - you'll have to ask Elegant Themes. Only solution we've found is to disable Divi Builder.

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 dots 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.


Was this answer helpful?

← Back