How to configure PHP limits in cPanel

Marc

Last Update 3 months ago

This topic covers processes relating to a cPanel service.
You will need to be logged into the cPanel account to follow the steps.
If you're not sure how to access your cPanel service — please, follow this guide before continuing: How do I Login to cPanel?

In order for your plugins and themes to run properly in WordPress they require minimum system requirements, so it's important that you make sure all the plugins and themes being used on your site have their system requirements met (such as PHP memory limits etc). If they're not, the plugins or themes might not work to their fullest potential or even  at all.


If you're experiencing issues it's recommended to double-check the minimum plugin/theme requirements within your plugin/theme author documentation or contact their support team for more information.


Many issues that you may encounter, such as the infamous "white screen of death", failed demo imports, empty page content, and other similar issues, are often related to incorrect PHP configuration limits. 

A solution is to increase these limits, which you can do within the hosting/cPanel service, using the steps below:

Available PHP limits that you can change on the fly using WP Hosting Shared Hosting Plans:

  • max_input_time
  • max_input_vars
  • memory_limit
  • post_max_size
  • upload_max_filesize

Steps on how to change the available PHP limits:

1. Login to cPanel

2. Look for the 'Software' section and click the 'Select PHP Version' tool.

3. Once you are already in the 'PHP Selector' page, click the 'options' tab.

4. Select your preffered max_execution_time:

    5. Select your preferred max_input_time:

      6. Select your preferred max_input_vars:

        7. Select your preferred memory_limit:

        8. Select your preferred post_max_size:

        9. Select your preferred upload_max_filesize:

          10. After you make changes, they will be automatically saved, and you can now return to your WordPress site to test the changes.


          PHP limits overview

          To further understand what the values in the steps mean or how they are used, you can refer to the definitions below:

          max_execution_time:

          The 'max_execution_time' is a PHP configuration directive that determines the maximum amount of time (in seconds) a PHP script is allowed to run before it is terminated by the server. This setting helps prevent poorly written or infinite loop scripts from consuming excessive server resources and causing performance issues or server crashes. The system default for our hosting plans is set to 30 seconds, but you can customize it according to the requirements of your WordPress plugins and themes.

          max_input_time:

          The "max_input_time" is a PHP configuration directive that specifies the maximum amount of time (in seconds) PHP scripts are allowed to parse input data, such as POST, GET, and file uploads. This directive helps prevent excessive consumption of server resources when handling the input of large data sets.

          If the script exceeds the "max_input_time" limit while processing input data, PHP will terminate the script and return an error message, such as a "500 Internal Server Error" or a "Maximum input time exceeded" message.

          max_input_vars:

          The "max_input_vars" is a PHP configuration directive that specifies the maximum number of input variables that are accepted from the GET, POST, and COOKIE input mechanisms. This directive helps prevent certain types of attacks, such as hash collisions or denial-of-service (dos) attacks, where a bad actor may attempt to overwhelm a server by sending a large number of input variables.

          If the number of input variables exceeds the "max_input_vars" limit, PHP will truncate the input variables beyond the limit.

          memory_limit:

          If a PHP script attempts to allocate more memory than the "memory_limit" allows, PHP will terminate the script and return an error message, such as a "500 Internal Server Error" or a "Fatal error: Allowed memory size exhausted" message.

          post_max_size:

          If the size of POST data exceeds the "post_max_size" limit, PHP will truncate the data beyond the limit, and the affected script may not receive all the submitted data. 

          upload_max_filesize:

          - If the size of an uploaded file exceeds the "upload_max_filesize" limit, PHP will not process the upload, and WordPress will display an error message to the user. You can set the "upload_max_filesize" up to 1Gb.

          Related Articles:

          Still need help? Message Us