Skip to main content

Customising PHP Settings (php.ini / .htaccess)

software, php, phpini, htaccess, configuration 0 Was this answer helpful?

PHP has many configurable settings that control memory limits, upload sizes, execution times, and error handling. You may need to adjust these for applications that handle large files, process complex data, or have specific requirements.

Please note: Screens and options may vary slightly depending on your cPanel version and hosting plan.

⚠️ Caution: Incorrect changes here can make your website inaccessible. If you are unsure about any step, please contact our support team before proceeding.

Using the MultiPHP INI Editor

  1. Log in to your cPanel account.
  2. In the Software section, click MultiPHP INI Editor.
  3. Select the Basic Mode or Editor Mode tab.

Basic Mode

Provides a simple interface for common settings:

  1. Select the domain from the dropdown.
  2. Adjust the settings as needed:

| Setting | Default | Description | |---------|---------|-------------| | memory_limit | 128M | Maximum memory a script can consume. Increase for memory-intensive applications. | | upload_max_filesize | 2M or 64M | Maximum size of an uploaded file. Increase for media-heavy sites. | | post_max_size | 8M or 128M | Maximum size of POST data. Should be larger than upload_max_filesize. | | max_execution_time | 30 | Maximum seconds a script can run. Increase for long-running processes. | | max_input_time | 60 | Maximum seconds for parsing input data. | | max_input_vars | 1000 | Maximum number of input variables. Increase if complex forms fail to submit. | | display_errors | Off | Whether to show errors on screen. Turn on for debugging, off for production. | | error_reporting | E_ALL & ~E_NOTICE | Which error types to report. |

  1. Click Apply.

Editor Mode

Allows you to directly edit the php.ini content:

  1. Select the domain.
  2. Edit the raw php.ini directives.
  3. Click Save.

Using .htaccess for PHP Settings

If you don't have access to the MultiPHP INI Editor, you can set some PHP values via .htaccess (for Apache with mod_php or suPHP):

php_value upload_max_filesize 64M
php_value post_max_size 128M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_vars 3000

Using a Local php.ini or .user.ini

For PHP-FPM or CGI/FastCGI handlers, create a .user.ini file in your website's document root:

upload_max_filesize = 64M
post_max_size = 128M
memory_limit = 256M
max_execution_time = 300
max_input_vars = 3000

Note: .user.ini files are cached for a period (typically 5 minutes). Changes may not take effect immediately.

Verifying Your Changes

Create a phpinfo.php file in your document root:

<?php phpinfo(); ?>

Visit https://yourdomain.com/phpinfo.php in your browser to see all current PHP settings. Delete this file after checking — it exposes sensitive server information.

Tips

  • Always set post_max_size larger than upload_max_filesize.
  • For WordPress, the media uploader respects both upload_max_filesize and post_max_size. If uploads fail, check both values.
  • On production sites, set display_errors to Off and log_errors to On. This logs errors to a file without exposing them to visitors.
  • The method for setting PHP values (MultiPHP INI, .htaccess, .user.ini) depends on how PHP is configured on your server. If one method doesn't work, try another.
  • Remember to delete phpinfo.php after use.

What Next?

Related Articles

knowledgebasedidyoufindanswer