Per domain PHP customization in cPanel

As you probably already know, PHP is a scripting language commonly used to build websites and web applications. What you may not know is that PHP can be customized to better meet the needs of your website or chosen Content Management System (CMS). This customization can fulfill many purposes, from increasing the memory available to changing security settings.

While there are literally thousands of possible combinations, your developer can usually find a happy balance that allows all of your sites to function without affecting each other. When this is the case, it is always recommended to simply make the necessary changes through WHM by choosing the PHP Configuration Editor option under the Service Configuration heading:
WHM >> Service Configuration >> PHP Configuration Editor

If for some reason this is not possible, for instance if two of your sites require conflicting configuration values, it becomes necessary to customize PHP configuration settings for each domain (or at least for the conflicting domain).

cPanel currently offers four different PHP handlers; four different interpreters for PHP to use to communicate with the web server (generally Apache). Each of these handlers has it’s own story and it’s own pros and cons, details that are better left for an article of their own. The important thing to note is that while all four of these handlers allow for customizing PHP for individual domains, the steps to accomplish this end differ considerably. To make this often necessary task a little easier, we have assembled the following instructions customized for each PHP handler.

Instructions for customizing PHP for each handler

 

One important note before we begin:

CGI and FastCGI require the custom php.ini to contain a full PHP configuration, while DSO and suPHP can contain only those parameters you wish to override. For consistency and to facilitate easier switching between modes, however, we will recommend that regardless of the PHP handler you choose to use a full PHP configuration file. The default location for the main php.ini file on your cPanel server to copy should be /usr/local/lib/php.ini

suPHP
FCGI/CGI
DSO

Was this article helpful?

Yes (8)
No (2)

We're sorry you didn't find this article very helpful. Please help us improve it by leaving your feedback below.

Error