Introduction
As there are multiple ways to set PHP values in cPanel & WHM, this guide will walk you through each of these different methods and provide insight on when to use each interface.
Procedure
For cPanel users
If you are only trying to resolve issues with your individual cPanel site, you can adjust a subset of PHP.ini values via cPanel's "MultiPHP INI Editor." The "Basic Mode" allows you to edit the most common PHP options, while "Editor Mode" allows you to set most options by editing the php.ini itself.
- Log in to cPanel.
- Navigate to "cPanel / Software / MultiPHP INI Editor."
- In "Basic Mode," choose your domain from the dropdown menu to load and view your current settings.
- Make any adjustments, such as to "memory_limit," then click "Apply" at the bottom of the page.
- If an option is not available in "Basic Mode," the "Editor Mode" can be used to make advanced configuration changes to your sites.
- If the "Editor Mode" is blank, click "Apply" from the "Basic Mode" screen first to create the php.ini file in your document root.
For WHM Users
If you're making changes to the system-wide PHP settings or want to disable a feature outright, such as PHP's exec() function, you'll want to utilize WHM's "MultiPHP INI Editor" instead of cPanel.
- Log in to WHM.
- Navigate to "WHM / Software / MultiPHP INI Editor."
- In "Basic Mode," choose your desired PHP version from the dropdown menu to load and view your current settings.
- Make any adjustments, such as to "memory_limit," then click "Apply" at the bottom of the page.
- If an option is not available in "Basic Mode," the "Editor Mode" can be used to make advanced configuration changes to each PHP version.
Via the Command-Line
Each installed PHP version will have its own php.ini file. Admins or SSH users can modify the files manually. Each PHP version is installed within "/opt/cpanel/" under their own respective "ea-phpXX" directories:
/opt/cpanel/ea-phpXX/root/etc/php.ini
For example, PHP 8.1 uses the following path:
/opt/cpanel/ea-php81/root/etc/php.ini
If PHP-FPM is in use, restart it after making any changes to these files:
/scripts/restartsrv_apache_php_fpm
Resources
For more information about these views, please see our documentation:
Comments
0 comments
Article is closed for comments.