Most "file too large" and "allowed memory size exhausted" errors on a cPanel server come down to four PHP settings. The MultiPHP INI Editor lets you change them without hunting for the right php.ini file by hand. This guide shows how to change limits for one domain in cPanel and for a whole PHP version in WHM, and how to check the new values are live.
Note: You buy one from cPanel or a partner and install it on your Linux VPS.
Before you start
- cPanel & WHM installed on your Linux VPS, with root access for WHM or a cPanel login for a single account.
- The domain's PHP version. You can see it in WHM » Software » MultiPHP Manager or cPanel » Software » MultiPHP Manager.
- An idea of what you need. Raise limits to what the application asks for, not to the maximum.
The four settings that matter
- memory_limit: the most memory one PHP request may use, for example
256M. WordPress with page builders or WooCommerce often wants 256M or more. - upload_max_filesize: the largest single file PHP accepts in an upload, for example
64M. - post_max_size: the largest whole form submission. It must be equal to or larger than
upload_max_filesize, or large uploads still fail. - max_execution_time: how many seconds a script may run before PHP stops it, for example
120.
A sensible set for a typical WordPress site:
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 120Tip: Bigger is not always better. A high memory_limit multiplied by many PHP processes can use up all RAM on a small VPS. Raise values in steps.
Change limits for one domain in cPanel
- Log in to cPanel and open Software » MultiPHP INI Editor.
- Stay on the Basic Mode tab.
- In Configure PHP INI basic settings, choose the domain from the location menu.
- Find each directive in the list and type the new value, such as
256Mformemory_limit. - Click Apply.
cPanel writes the values to the configuration file that the domain's PHP handler reads, inside the domain's document root. For PHP-FPM domains this is usually .user.ini.
Editor Mode
The Editor Mode tab shows the raw file for a location. Use it when a directive is not in the Basic Mode list. Type one directive per line in name = value form and click Save.
Warning: A typing mistake in Editor Mode can stop PHP from reading the rest of the file. Copy the current contents somewhere safe before you edit.
Change limits for a whole PHP version in WHM
As root you can change the default for every site that uses a PHP version.
- Log in to WHM and open Software » MultiPHP INI Editor.
- On Basic Mode, choose a PHP version, for example
ea-php83. - Change the values and click Apply.
This edits the main php.ini for that version, such as /opt/cpanel/ea-php83/root/etc/php.ini. Every account on that version picks up the new defaults unless a domain overrides them in its own file.
Domain-level settings win over the version default. Use WHM for a sensible baseline, then raise limits only for the sites that need more.
Check it works
PHP-FPM caches .user.ini values for a few minutes, so a change may not show instantly. To see the live values, create a small test file in the domain's document root, for example public_html/limits.php:
cat > /home/USER/public_html/limits.php <<'EOF'
<?php
foreach (['memory_limit','upload_max_filesize','post_max_size','max_execution_time'] as $k) {
echo $k . ' = ' . ini_get($k) . PHP_EOL;
}
EOF
chown USER:USER /home/USER/public_html/limits.phpReplace USER with the cPanel username, then open https://example.com/limits.php. You should see your new values. Delete the file afterwards:
rm /home/USER/public_html/limits.phpTo check a version's default from the command line:
/opt/cpanel/ea-php83/root/usr/bin/php -i | grep -E 'memory_limit|upload_max_filesize|post_max_size|max_execution_time'Troubleshooting
- Values do not change: the domain may use a different PHP version than the one you edited in WHM. Check MultiPHP Manager, then edit the right version or use the domain-level editor.
- Still waiting after a change: PHP-FPM re-reads
.user.inionly after its cache time passes. Wait five minutes, or restart PHP-FPM in WHM » Restart Services » PHP-FPM service for Apache. - Uploads still fail at the same size:
post_max_sizeis smaller thanupload_max_filesize, or the application has its own limit. Some web server or proxy limits apply too, for example NGINXclient_max_body_sizewhen NGINX sits in front. - 500 error after editing: a syntax error or an unsupported
php_valueline in.htaccesscan break the site under PHP-FPM. Remove recentphp_valuelines from.htaccessand use the editor instead. - Script still times out at 30 or 60 seconds: a web server or proxy timeout may be shorter than
max_execution_time. Check the ApacheTimeoutvalue in WHM as well.
Next steps
- Choose the PHP version per domain: use MultiPHP Manager in cPanel.
- Size PHP processes for your RAM: enable and tune PHP-FPM in cPanel.
- Add missing extensions: install PHP extensions on cPanel.
