Web HostingPublished on December 16, 202510 min read

How to modify PHP settings (php.ini) on cPanel

PHP settings, the ones in the php.ini file, control script memory, upload size, execution time and error display. On OuiHeberg web hosting, the most common ones are set in the client area. The others are changed in cPanel with the MultiPHP INI Editor. This guide covers both, then what each directive does and the values to use for each type of site.


Modify PHP settings in the client area

  1. Log in to dash.ouiheberg.com. In the left menu, click My Services, then your hosting plan.

  2. Open the PHP version tab and scroll down to the PHP configuration card.

  3. Change the value of the setting you need.

The PHP version per domain card is for changing versions: dash then asks you to confirm before applying. In the PHP configuration card, each line shows the setting's name and its PHP directive. Below it, the page shows the recommended value, the default value and the range allowed on your hosting. The card covers these directives, among others.

Setting in the client areaDirective
Memory per Scriptmemory_limit
Script Durationmax_execution_time
Reading Received Datamax_input_time
Form Fieldsmax_input_vars
Uploaded File Sizeupload_max_filesize
Form Sizepost_max_size
File Uploadsfile_uploads

PHP configuration card with memory per script, script duration and upload size

For other directives, such as display_errors, error_reporting or date.timezone, use cPanel. The guide Access cPanel and manage your OuiHeberg web hosting covers the rest of the page.


Method 1: MultiPHP INI Editor (basic mode)

The basic mode of the MultiPHP INI Editor shows the common directives as fields and switches.

  1. On the hosting page, click Advanced panel at the top right. cPanel opens straight away, with no login details to type.

  2. In the Software section, click MultiPHP INI Editor. You can also type "INI" in the Search Tools bar.

  3. Stay on the Basic Mode tab.

  4. In the list, pick the domain to configure. The home directory applies the settings to the whole account.

  5. Change the values, then click Apply at the bottom of the page.

The screen shows the path of the file being edited, public_html/php.ini for the main domain, and the domain's PHP version. Basic mode lists about fifteen directives, including memory_limit, upload_max_filesize, post_max_size, max_execution_time, max_input_vars, display_errors and error_log. The exact list depends on the PHP version.

MultiPHP INI Editor in basic mode with the selected domain and its directives

As the banner at the top of the screen says, the editor writes to php.ini, .user.ini and .htaccess, each directive only in the files that accept it. Do not edit these lines by hand.


Method 2: MultiPHP INI Editor (editor mode)

Editor mode opens the whole file. Use it for directives that basic mode does not show, such as date.timezone, error_reporting or max_input_nesting_level.

  1. In the MultiPHP INI Editor, open the Editor Mode tab.

  2. Pick the domain, or the home directory for the whole account.

  3. Add or edit lines, one directive per line. A semicolon at the start of a line marks a comment.

  4. Click Save, at the top right.

; Memory and limits
memory_limit = 512M
upload_max_filesize = 128M
post_max_size = 256M

; Execution time
max_execution_time = 600
max_input_time = 600

; Input variables
max_input_vars = 5000

; Errors (live site)
display_errors = Off
log_errors = On
error_reporting = E_ALL & ~E_DEPRECATED

; Sessions
session.gc_maxlifetime = 1440

; Time zone
date.timezone = Europe/London

MultiPHP INI Editor in editor mode with the contents of the configuration file

A typo in this file can upset the whole PHP configuration. Change one directive at a time and check the site after each save.


Method 3: .user.ini file (PHP-FPM)

PHP runs with PHP-FPM on our servers. In this mode, PHP also reads the .user.ini files placed in the site's folders, so a folder can have its own settings.

  1. In cPanel, open the File Manager, then the domain's root folder (public_html for the main domain).

  2. Create or edit the .user.ini file. If it does not appear, show hidden files in the File Manager settings.

  3. Add one directive per line, then save.

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

The setting applies to this folder and its subfolders. PHP rereads this file at regular intervals, so a change can take a few minutes to apply. Only directives that can be set per folder are taken into account. allow_url_fopen, allow_url_include, disable_functions and expose_php are not among them.

The MultiPHP INI Editor also writes to this file. Stick to one method per folder so you know which value applies.


Verify changes

  • In WordPress, open Tools › Site Health, Info tab. The Server section gives the memory limit, the maximum upload size, the execution time and the number of input variables.

  • Also in WordPress, the page for adding media shows the maximum file size.

  • To see everything, create an info.php file in public_html, open https://mysite.com/info.php and search for the directive with Ctrl+F.

<?php
phpinfo();
?>

The Local Value column of phpinfo gives the value that applies to the site. Delete info.php right after, as it exposes the server configuration.


When to modify PHP settings?

An error message often points to the directive to change.

Message or symptomDirective
The uploaded file exceeds the upload_max_filesize directiveupload_max_filesize
Allowed memory size exhaustedmemory_limit
Maximum execution time exceededmax_execution_time
POST Content-Length exceeds the limitpost_max_size
A long form or a menu is only partly savedmax_input_vars
An import or export stops halfwaymax_execution_time, max_input_time

Detailed description of settings

The recommended values below are starting points. Stay within the range the client area shows for each setting.

memory_limit

Maximum memory a PHP script can use, for example memory_limit = 256M.

Type of siteRecommended value
Simple brochure site128M
WordPress blog256M
WordPress with many plugins256M to 512M
WooCommerce512M
Heavy PHP application512M to 1024M
Fatal error: Allowed memory size of 134217728 bytes exhausted

upload_max_filesize

Maximum size of an uploaded file, for example upload_max_filesize = 64M.

UseRecommended value
Web-optimised images16M
High-resolution photos32M
WordPress themes and plugins64M
Short videos128M
Large files256M or more
The uploaded file exceeds the upload_max_filesize directive in php.ini

post_max_size

Maximum size of all the data in a form, files included. It must be at least equal to upload_max_filesize, with some headroom for the other fields. With upload_max_filesize = 64M, use post_max_size = 128M for instance.

Warning: POST Content-Length of X bytes exceeds the limit of Y bytes

max_execution_time

Maximum run time of a script, in seconds, for example max_execution_time = 300.

TaskRecommended value
Normal browsing30 (default value)
WordPress import or export300
Report generation300 to 600
Site migration600 to 900
Backup run by a plugin600
Fatal error: Maximum execution time of 30 seconds exceeded

max_input_time

Maximum time PHP gets to read incoming data (forms, uploads), in seconds, for example max_input_time = 300. Allow 60 for simple forms, 300 for large uploads and 300 to 600 for a CSV or XML import. The value -1 reuses the max_execution_time duration.

max_input_vars

Maximum number of fields a form can send, for example max_input_vars = 3000.

Type of contentRecommended value
Simple site1000 (default value)
WordPress with long menus3000
WooCommerce with attributes5000
Page builders (Elementor, Divi)5000 to 10000

A value that is too low shows up as WordPress menus saved halfway, theme options that vanish or lost WooCommerce variations.

display_errors

Shows PHP errors in the page. Keep it Off on a live site, because the messages can reveal paths or queries.

display_errors = Off   ; live site
display_errors = On    ; development only

error_reporting

Chooses which errors PHP reports.

ValueEffect
E_ALLall errors
E_ALL & ~E_NOTICEeverything except notices
E_ALL & ~E_DEPRECATEDeverything except deprecation warnings
0no errors

On a live site, keep errors in a log rather than on screen.

error_reporting = E_ALL & ~E_DEPRECATED

error_log

File where PHP writes errors. Handy for debugging without showing anything to visitors, for example with error_log = /home/user/logs/php_errors.log.

allow_url_fopen

Lets PHP open a web address as if it were a file. WordPress uses it for updates, RSS feeds and some APIs. It is usually left at allow_url_fopen = On.

allow_url_include

Allows remote code to be included with include or require. Keep allow_url_include = Off, because turning it on opens the door to code injection. The directive has also been deprecated since PHP 7.4.


Copy the block that matches your site into editor mode or into .user.ini, then adjust it.

Brochure site or simple blog

memory_limit = 128M
upload_max_filesize = 32M
post_max_size = 64M
max_execution_time = 120
max_input_time = 120
max_input_vars = 1000

Standard WordPress

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

WordPress with a page builder (Elementor, Divi, WPBakery)

memory_limit = 512M
upload_max_filesize = 128M
post_max_size = 256M
max_execution_time = 600
max_input_time = 600
max_input_vars = 10000

WooCommerce and online shops

memory_limit = 512M
upload_max_filesize = 128M
post_max_size = 256M
max_execution_time = 600
max_input_time = 600
max_input_vars = 5000

PrestaShop

memory_limit = 512M
upload_max_filesize = 64M
post_max_size = 128M
max_execution_time = 600
max_input_time = 600
max_input_vars = 20000

Custom PHP application or API

memory_limit = 256M
upload_max_filesize = 128M
post_max_size = 256M
max_execution_time = 300
max_input_time = 300
max_input_vars = 3000
allow_url_fopen = On

Troubleshooting

Changes not taking effect

Possible causeSolution
.user.ini file not reread yetWait a few minutes, then reload phpinfo.
Wrong domain selectedCheck the domain selected in the MultiPHP INI Editor.
php_value line in .htaccessRemove it and set the value in the client area or in the editor.
Directive set by the serverallow_url_fopen or disable_functions cannot be changed per folder. Open a ticket if phpinfo does not show the value you want.
Value outside the allowed rangeUse a value within the range shown in the client area.

"The uploaded file exceeds the upload_max_filesize directive in php.ini"

WordPress shows this message when a file is larger than upload_max_filesize. If the limit shown on the page for adding media does not change after you raise it, check these points in order.

  1. upload_max_filesize has the new value in phpinfo, Local Value column.

  2. post_max_size is at least equal to upload_max_filesize.

  3. No plugin or theme sets its own limit.

500 error after a change

Undo the last change in the MultiPHP INI Editor or in .user.ini, then add the directives back one by one to find the one at fault. If you added php_value or php_flag lines to .htaccess, delete them with the File Manager.

"php_value not allowed here"

The cPanel error log (Metrics section, Errors tool) shows one of these messages when .htaccess contains a php_value line. With PHP-FPM, Apache does not know this command, and the whole site returns a 500 error.

.htaccess: php_value not allowed here
.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration

Delete the line from .htaccess, then set the value in the client area, in the MultiPHP INI Editor or in .user.ini.

max_input_vars ignored

Check the value in phpinfo, Local Value column. If it is right but a WordPress menu still gets cut, reduce the number of menu items or split it into several menus.


Complete list of useful PHP directives

DirectiveRoleExample
memory_limitmaximum memory per script256M
max_execution_timemaximum run time, in seconds300
max_input_timemaximum time to read incoming data300
max_input_varsmaximum number of incoming fields3000
max_input_nesting_levelmaximum depth of incoming arrays64
upload_max_filesizemaximum size of an uploaded file64M
post_max_sizemaximum size of a form128M
max_file_uploadsnumber of files uploaded at once20
file_uploadsallows file uploadsOn
display_errorsshows errors in the pageOff
log_errorswrites errors to a logOn
error_reportinglevel of reported errorsE_ALL & ~E_DEPRECATED
error_logerror log file/home/user/logs/php_errors.log
session.gc_maxlifetimelifetime of a session, in seconds1440
session.cookie_lifetimelifetime of the session cookie (0 until the browser closes)0
allow_url_fopenopens a web address as a fileOn
allow_url_includeincludes remote codeOff
expose_phpshows the PHP version in the headersOff
disable_functionsdisabled functionsexec,shell_exec
date.timezonetime zoneEurope/London
default_charsetdefault encodingUTF-8
short_open_tagaccepts the short <? tagOff
output_bufferingoutput buffer, in bytes4096

allow_url_include, expose_php and disable_functions are set at server level. To change one, open a ticket.


Need help?

Open a ticket from Tickets › Open a ticket (dash.ouiheberg.com/tickets/new), or click the Contact support tile at the bottom of your hosting page. You can also ask your question on our Discord.

Was this article helpful?

651 views
Share this article
Hébergement web
Need web hosting?

cPanel hosting with email accounts and databases, managed from the OuiHeberg client area.

View plans →

Related Articles