There was a problem loading the comments.

How to Adjust PHP Limits (upload_max_filesize, memory_limit, etc.) in cPanel and DirectAdmin

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
  • 24 April 2026 10:59 AM

How to Adjust PHP Limits (upload_max_filesize, memory_limit, etc.) in cPanel and DirectAdmin

Overview

PHP has a number of configurable limits that affect how your website runs. When these limits are too low, you'll see errors like:

  • "The uploaded file exceeds the upload_max_filesize directive in php.ini"
  • "Fatal error: Allowed memory size of X bytes exhausted"
  • "Maximum execution time of 30 seconds exceeded"
  • "POST Content-Length exceeds the limit"

This article covers the most commonly adjusted PHP limits, what they do, and how to change them yourself using the tools in cPanel and DirectAdmin.


Common PHP Limits Explained

Directive Purpose Typical Default Common Adjusted Value
memory_limit Maximum memory a single PHP script can use 128M 256M or 512M
upload_max_filesize Maximum size of a single uploaded file 2M or 64M 128M or 256M
post_max_size Maximum size of all POST data (must be ≥ upload_max_filesize) 8M or 64M 128M or 256M
max_execution_time Maximum seconds a script can run 30 120 or 300
max_input_time Maximum seconds PHP spends parsing input data 60 120 or 300
max_input_vars Maximum number of input variables (fields in forms, etc.) 1000 3000 or 5000

Important relationships:

  • post_max_size must be greater than or equal to upload_max_filesize.
  • memory_limit must be greater than or equal to post_max_size.
  • A good rule of thumb: memory_limitpost_max_sizeupload_max_filesize.

Adjusting PHP Limits in cPanel

cPanel offers several ways to adjust PHP limits. The MultiPHP INI Editor is the preferred method for most customers.

Method 1: MultiPHP INI Editor (Recommended)

This is the easiest and most reliable method.

  1. Log in to cPanel.
  2. In the search bar at the top, type MultiPHP INI Editor and click the result.
  3. On the next page, you'll see two modes:
    • Basic Mode — Simple form with common directives.
    • Editor Mode — Full access to edit the raw php.ini content.
  4. In Basic Mode, select the domain you want to configure from the dropdown.
  5. You'll see a list of directives with their current values. Adjust as needed:
    • memory_limit
    • upload_max_filesize
    • post_max_size
    • max_execution_time
    • max_input_time
    • (Others may be available depending on the PHP version)
  6. Click Apply at the bottom.

Changes take effect immediately for that domain.

Method 2: Select PHP Version / PHP Selector

If the directive you need isn't in MultiPHP INI Editor (like max_input_vars), use the PHP Selector:

  1. In cPanel, search for Select PHP Version (or PHP Selector).
  2. Click the Options tab.
  3. You'll see a longer list of directives. Adjust the ones you need.
  4. Changes save automatically when you click out of each field.

Method 3: Custom php.ini File

If you need fine-grained control or the above tools don't expose a specific directive:

  1. Open File Manager in cPanel.
  2. Navigate to your site's root (usually public_html/).
  3. Click Settings (top right) and enable Show Hidden Files (dotfiles) — then click Save.
  4. Check if a php.ini file already exists. If not, click + File to create one, and name it php.ini.
  5. Right-click php.ini and choose Edit.
  6. Add or modify the directives you need. Example:
 
memory_limit = 256M
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300
max_input_time = 300
max_input_vars = 3000
  1. Save the file.

Note: On servers using CloudLinux/CageFS, a php.ini in your site root may not be read. In that case, use Select PHP Version → Options instead.

Method 4: .user.ini File

On some cPanel configurations, PHP reads from .user.ini files. The process is identical to Method 3 but the filename is .user.ini instead of php.ini.

Method 5: .htaccess Directives (Legacy)

If your server runs PHP as an Apache module (mod_php, which is rare on modern cPanel), you can set limits in .htaccess:

 
php_value memory_limit 256M
php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300

Important: This only works with mod_php. On most modern cPanel servers (which use PHP-FPM, LiteSpeed, or suPHP), these directives will cause a 500 Internal Server Error. If you see this error after adding them, remove the lines immediately. Use MultiPHP INI Editor instead.


Adjusting PHP Limits in DirectAdmin

DirectAdmin's PHP configuration is usually handled through the PHP Selector (on CloudLinux servers) or directly via custom php.ini files.

Method 1: PHP Selector (CloudLinux Servers)

  1. Log in to DirectAdmin.
  2. From the dashboard, look for Select PHP Version (under Account Manager or Extra Features depending on skin).
  3. Click Options or PHP Settings.
  4. You'll see a list of directives with editable values:
    • memory_limit
    • upload_max_filesize
    • post_max_size
    • max_execution_time
    • max_input_time
    • max_input_vars
  5. Edit the values and click Save (or changes may auto-save depending on version).

Method 2: Custom php.ini File

If PHP Selector isn't available or doesn't expose the directive you need:

  1. Open File Manager.
  2. Navigate to domains/yourdomain.com/public_html/.
  3. Create a new file called php.ini (or edit the existing one).
  4. Add the directives you need:
 
memory_limit = 256M
upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300
max_input_time = 300
max_input_vars = 3000
  1. Save.

Method 3: .user.ini File

Some DirectAdmin configurations use .user.ini instead of php.ini. If php.ini doesn't work, try creating .user.ini with the same contents in the same location.

Method 4: Per-Domain PHP Configuration

DirectAdmin allows per-domain PHP settings on some servers:

  1. Go to Domain Setup and click your domain.
  2. Look for PHP Settings or Custom PHP Configuration.
  3. If available, enter your directives there.

This method varies significantly by server configuration; if you don't see it, use Method 2 or 3.


Verifying Your Changes

After adjusting PHP limits, confirm they've taken effect.

Create a phpinfo Page

  1. In File Manager, navigate to your site root.
  2. Create a new file called phpinfo.php.
  3. Edit it and add this single line:
 
<?php phpinfo(); ?>
  1. Save.
  2. Visit yourdomain.com/phpinfo.php in your browser.
  3. Search the page (Ctrl+F / Cmd+F) for the directive you changed (e.g., memory_limit).
  4. You'll see two columns: Local Value and Master Value. The Local Value reflects your custom setting.

Important: Delete phpinfo.php after verifying. Leaving it accessible is a security risk — it exposes details about your server environment that could help an attacker.

Check via WordPress Site Health

If you're on WordPress:

  1. Log in to wp-admin.
  2. Go to Tools → Site Health → Info.
  3. Expand the Server section.
  4. You'll see PHP memory limit, PHP max input time, PHP max execution time, and more.

Check via a Plugin

Plugins like WP-ServerInfo or Query Monitor display active PHP limits directly in the WordPress dashboard.


Common Scenarios

"Increase Max Upload Size" for WordPress Media or WooCommerce Imports

Adjust these three together:

 
upload_max_filesize = 256M
post_max_size = 256M
memory_limit = 512M

"Fix Fatal Error: Allowed Memory Size Exhausted"

Start with memory_limit = 256M. If the error persists, try 512M.

"Fix Timeout When Running Large Imports or Backups"

 
max_execution_time = 600
max_input_time = 600

Some backup and import plugins also have their own internal timeout settings — check the plugin's settings page as well.

"Form Submissions Losing Data (Many Fields)"

Increase max_input_vars:

 
max_input_vars = 5000

This is common with large WooCommerce products, Gravity Forms, or page builders like Elementor with many settings.

"HTTP 413 — Request Entity Too Large"

This is a web server limit, not PHP. It's often caused by nginx, LiteSpeed, or Apache's LimitRequestBody directive, not upload_max_filesize. If adjusting PHP doesn't help, open a ticket — we may need to increase the web server limit.


Important Notes

Your Changes May Be Capped by Server Limits

Your hosting plan or the server's global configuration may cap certain limits. For example, if the server allows a maximum memory_limit of 512M, setting 1024M in your php.ini won't actually give you 1024M — it'll be silently capped at 512M.

If you need a limit raised above what the server allows, contact support with your use case.

Changes Only Affect Your Account

Adjusting PHP limits in cPanel or DirectAdmin only affects your account — it doesn't impact other customers on the server.

PHP-FPM Caching

On servers using PHP-FPM (most modern setups), changes take effect immediately for new requests. You don't need to restart anything.

Child Domains and Subdomains

On cPanel, each addon domain or subdomain can have its own PHP settings. Use MultiPHP INI Editor to configure them individually if needed. A php.ini in the root of each domain's document root will apply to that domain only.


When to Contact Support

Try the self-service methods first — they cover nearly every case. Open a ticket if:

  • You've adjusted a limit via the control panel and a phpinfo page still shows the old value.
  • You need a limit raised above the server maximum (uncommon but possible for legitimate use cases like very large media libraries).
  • You're getting a 413 or similar web server error that isn't fixed by PHP changes.
  • You're unsure which directive applies to your specific error and the guide above doesn't match your situation.

When opening a ticket, please include:

  • The exact error message you're seeing.
  • The directive(s) you've already tried changing and their values.
  • The URL to a phpinfo page (if safe to share temporarily — delete it right after).
  • What you're trying to do (upload a large file, import a CSV, etc.) so we can recommend the right settings.

Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  

© LaunchCDN