How to enable custom php ini in cPanel servers with suPHP using EasyApache 4
PHP is a commonly used scripting language for websites, and its configuration settings can be managed using a server-wide php.ini file.
Most shared hosting providers enforce server-wide php ini settings on all users. But some software such as WordPress, Joomla, etc. require custom PHP ini for websites.
To allow users to configure their custom PHP settings, SuPHP can be enabled in a server. This will allow them to override the server-wide PHP settings.
PHP configuration in cPanel/WHM servers
In cPanel/WHM servers, the script EasyApache is used to recompile Apache/PHP in the server and to customize the php.ini settings.
Our 24/7 US based phone support team coordinates with the helpdesk support team to quickly customize server settings for the customers. Learn more.
When the latest version EasyApache 4 was released, it came with many features such as PHP 7 support and custom PHP version per website.
Today we’ll see the steps to enable custom php ini for users in cPanel servers with suPHP using EasyApache 4.
Enable custom php ini in cPanel servers using EasyApache 4
Unlike its previous versions, EasyApache 4 uses ‘rebuild_phpconf’ script to manage PHP settings. As a result, its configuration is a bit different.
On servers with EasyApache 4, multiple ‘
php.ini' and ‘
local.ini' files manages the PHP settings. To enable custom php ini, the steps are:
Step 1 – Locate the local.ini file
The first step is to ensure that ‘local.ini’ file is present for the PHP version in the following folder:
Step 2 – Generate ini file
If local.ini file is NOT present in the location ‘/opt/cpanel/ea-php<php version>/root/etc/php.d’, go to “MultiPHP INI Editor” in WHM.
Step 3 – Choose the corresponding version of PHP
Since Easyapache 4 supports multiple PHP versions, it will show them as options in the editor. Select a PHP version that you want to be installed in your server.
Once you select the PHP version that you want from the drop down, you would be presented with the php.ini file corresponding to that version.