How to Change PHP Limits (upload_max_filesize, post_max_size, memory_limit) Print

  • 0

PHP limits control things like the largest file you can upload, how much memory a script can use and how long it can run. You may need to raise them if uploads fail, a large import times out or WordPress reports a memory error. You change them yourself on the Options tab of the PHP Selector.

Change a PHP setting

  1. Log in to cPanel and go to Software › Select PHP Version.
  2. Make sure a numbered PHP version is selected, not native; options can't be changed on native (see change your PHP version).
  3. Open the Options tab.
  4. Find the setting and choose a new value from its drop-down, or tick or untick it for on/off settings. Changes save automatically.
  5. Test your site again. Some apps cache these values, so you may need to reload the page or clear the app's cache.

The settings you're most likely to need

SettingWhat it controls
upload_max_filesizeThe largest single file that can be uploaded through your site, such as a media file or plugin zip.
post_max_sizeThe total size of a form submission, including all uploaded files. Set it equal to or larger than upload_max_filesize, or big uploads will still fail.
memory_limitHow much memory one PHP script can use. Raise it if you see "Allowed memory size exhausted" errors.
max_execution_timeHow many seconds a script can run before it's stopped. Raise it for long imports or backups.
display_errorsShows PHP errors on the page. Turn it on briefly to debug, then turn it off again: on a live site it can reveal file paths and other details to visitors.
allow_url_fopenLets scripts open remote URLs as if they were files. Some apps need it; leave it off if yours doesn't.

Good to know

  • The values offered in the drop-downs are the ones your plan allows. Your account also has an overall resource allowance, so setting a very high memory_limit won't give a script more memory than your plan provides.
  • Settings are per PHP version. If you switch version, check the Options tab again.
  • If you need a value higher than the drop-down offers, open a support ticket and tell us what the app needs.

Getting a memory error in WordPress? See fix "Allowed memory size exhausted" errors.


Was this answer helpful?

« Back