There are certain scenarios when you may be asked to make changes to your PHP configuration. Specifically, you may be directed to edit a file on your server called php.ini
, and to increase the PHP Memory limit (memory_limit
), or the PHP Upload limit (upload_max_filesize
).
How to Increase the PHP Memory Limit
The memory_limit
is a setting managed through the PHP Options, which is the max amount of memory a script may consume. This value should be set at least as big as post_max_size
.
While we do not allow direct changes to php.ini
on our servers, PHP configuration changes can be made from cPanel by following these steps:
- Log into cPanel;
- Look for the Software section and click on Select PHP version:
The PHP Selector is not included by default in cPanel and might be missing from your account if your host is not FastComet. If that's the case, you should contact your web host.
- In the new window click on Options:
- Locate the
memory_limit
and click on the dropdown menu beside it. The menu will allow you to change the value as required. Check your script, plugin, or theme's requirements and use the correct value. - After you did the change, the new value will be automatically updated. If you were successful, you will see a green box at the top-right corner of your screen with a message that confirms the change has been auto-saved.
That's how you increase the PHP memory limit in cPanel.
How to Increase the PHP Upload Limit
The steps you need to follow here is similar:
- Log into cPanel;
- Click on Select PHP version:
- Click on Options:
- Locate the
upload_max_filesize
and click on the dropdown menu beside it. The menu will allow you to change the value as required. - Again the new value will be automatically updated. If you were successful, you will see a green box at the top-right corner of your screen with a message that confirms the change has been applied.
That's how you increase the PHP upload limit in cPanel.
Final Thoughts
Change the memory_limit
and upload_max_filesize
only when you absolutely need to. When it comes to access, it's best to keep everything as strict and minimal as possible.