Knowledgebase

How to increase memory_limit, upload_max_filesize and max_execution_time in cPanel

Errors such as "The uploaded file exceeds the upload_max_filesize directive", "Allowed memory size exhausted" or "Maximum execution time exceeded" mean that a PHP setting is too low for what your site is doing. This guide shows you how to increase memory_limit, upload_max_filesize, post_max_size and max_execution_time in cPanel without editing server files.

The settings you will usually change

SettingWhat it controlsCommon value
memory_limitMemory one PHP script may use256M
upload_max_filesizeLargest single file you can upload64M or 128M
post_max_sizeLargest form submission (must be equal to or larger than the upload size)64M or 128M
max_execution_timeSeconds a script may run120 to 300
max_input_varsNumber of form fields (large menus, page builders)3000 to 5000

The values above are typical examples, not requirements. Ask your theme or plugin developer what they recommend.

Method 1: Select PHP Version (CloudLinux)

Most EgWeb hosting accounts run on CloudLinux, so this is usually the right method.

  1. Log in to cPanel (how to log in to cPanel) and open Select PHP Version in the Software section.
  2. Check the current version at the top. If it says native, the options cannot be changed there. Choose a supported version such as 8.2 or 8.3 first (see how to change the PHP version).
  3. Click the Options tab.
  4. Find memory_limit, upload_max_filesize, post_max_size and max_execution_time, and pick the new values from the lists.
  5. Changes are saved automatically. Wait a few seconds, then test your site.

Method 2: MultiPHP INI Editor

Use this method if your account does not have Select PHP Version, or if our support team tells you that your domain uses the cPanel MultiPHP versions.

  1. In cPanel open MultiPHP INI Editor (also in Software).
  2. On the Basic Mode tab, choose your domain from the drop-down list.
  3. Change the values you need and click Apply.

The editor saves the values in a .user.ini or php.ini file inside the domain folder. Do not create several copies of these files in different folders by hand, because that makes it hard to know which value is active.

Important: Do not add php_value lines to .htaccess unless support asks you to. Depending on how PHP runs on the server, these lines may be ignored or may cause a 500 Internal Server Error.

How to check that the new values are active

  • WordPress: go to Tools > Site Health > Info and open the Server section. It shows the PHP memory limit, maximum upload size and maximum execution time.
  • Any PHP site: create a file named info.php containing the code below, open it in your browser, search for the setting, then delete the file, because it shows details about your server.
<?php phpinfo();

Common problems

  • The value did not change: you may have edited a different PHP version from the one your domain uses, or a .user.ini file in the site folder is overriding it. PHP can also take a few minutes to reload .user.ini files.
  • WordPress still shows 40M or 128M memory: WordPress has its own limit. Add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php. It cannot go above the PHP memory_limit.
  • Uploads still fail: raise post_max_size as well. It must be at least as large as upload_max_filesize.
  • You cannot choose a higher value: every plan has upper limits set on the server. Contact us if your project really needs more, or consider a VPS.

Frequently asked questions

Will a very high memory_limit make my site faster?

No. It only allows a script to use more memory. A script that needs a huge amount usually points to a heavy plugin or a coding problem. See how to speed up your WordPress website.

Do these settings apply to all my domains?

In Select PHP Version they apply to the whole account. In MultiPHP INI Editor you choose the domain.

Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.

  • php.ini, memory_limit, upload_max_filesize, max_execution_time, select php version, multiphp ini editor, cpanel

Was this answer helpful?

0 Users Found This Useful