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
| Setting | What it controls | Common value |
|---|---|---|
memory_limit | Memory one PHP script may use | 256M |
upload_max_filesize | Largest single file you can upload | 64M or 128M |
post_max_size | Largest form submission (must be equal to or larger than the upload size) | 64M or 128M |
max_execution_time | Seconds a script may run | 120 to 300 |
max_input_vars | Number 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.
- Log in to cPanel (how to log in to cPanel) and open Select PHP Version in the Software section.
- 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).
- Click the Options tab.
- Find
memory_limit,upload_max_filesize,post_max_sizeandmax_execution_time, and pick the new values from the lists. - 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.
- In cPanel open MultiPHP INI Editor (also in Software).
- On the Basic Mode tab, choose your domain from the drop-down list.
- 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.
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.phpcontaining 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.inifile in the site folder is overriding it. PHP can also take a few minutes to reload.user.inifiles. - WordPress still shows 40M or 128M memory: WordPress has its own limit. Add
define( 'WP_MEMORY_LIMIT', '256M' );towp-config.php. It cannot go above the PHPmemory_limit. - Uploads still fail: raise
post_max_sizeas well. It must be at least as large asupload_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.