Control panels

Change PHP limits with the cPanel MultiPHP INI Editor

Raise memory_limit, upload_max_filesize, post_max_size and max_execution_time in cPanel or WHM with the MultiPHP INI Editor, per PHP version or per domain.

BeginnerLinux server5 min read

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:

INI
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 120

Tip: 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

  1. Log in to cPanel and open Software » MultiPHP INI Editor.
  2. Stay on the Basic Mode tab.
  3. In Configure PHP INI basic settings, choose the domain from the location menu.
  4. Find each directive in the list and type the new value, such as 256M for memory_limit.
  5. 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.

  1. Log in to WHM and open Software » MultiPHP INI Editor.
  2. On Basic Mode, choose a PHP version, for example ea-php83.
  3. 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:

Bash
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.php

Replace USER with the cPanel username, then open https://example.com/limits.php. You should see your new values. Delete the file afterwards:

Bash
rm /home/USER/public_html/limits.php

To check a version's default from the command line:

Bash
/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.ini only 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_size is smaller than upload_max_filesize, or the application has its own limit. Some web server or proxy limits apply too, for example NGINX client_max_body_size when NGINX sits in front.
  • 500 error after editing: a syntax error or an unsupported php_value line in .htaccess can break the site under PHP-FPM. Remove recent php_value lines from .htaccess and 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 Apache Timeout value in WHM as well.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.