Some hosting clients require special setups of their PHP configurations – and searching online revealed a lot of information but scattered all around various blogs / tech sites.
To help others with this configuration we’ve collected all the info here:
Here is a simple step by step to customise php.ini for a specific client domain on CPANEL 11 + suPHP enabled on APACHE 2.x
NOTE: replace ‘username’ and ‘userdomain’ with your client’s username and domain name
If you take a look at your http.conf file ( /usr/local/lib/php.ini ) you will see this in your specific domain’s VirtualHost container:
# To customize this VirtualHost use an include file at the following location
# Include “/usr/local/apache/conf/userdata/std/2/username/userdomain/*.conf”
NOTE: DO NOT EDIT THE httpd.conf FILE DIRECTLY – you must use the include files
NOTE: this is for Apache 2.2 – check httpd.conf for above include location reference
NOTE: do not uncomment / edit anything in httpd.conf
Create the include folder:
[]# mkdir -p /usr/local/apache/conf/userdata/std/2/username/userdomain
the -p switch creates any parent directories that do not exist
change to that directory
[]# cd /usr/local/apache/conf/userdata/std/2/username/userdomain
create suphp.conf in that folder – simply use vi text editor to create the file
[]# vi suphp.conf
in suphp.conf add
<IfModule mod_suphp.c>
suPHP_ConfigPath /etc/phpconf/username
</IfModule>
Save the file and return to command line
Now create the directory where the custom php.ini file will be stored for that user
[]# mkdir /etc/phpconf/username
copy global php.ini to /etc/phpconf/username
[]# cp -pv /usr/local/lib/php.ini /etc/phpconf/username/php.ini
edit the php.ini in /etc/phpconf/username – making directive changes as required
[]# vi /etc/phpconf/username/php.ini
save and exit
Now run /scripts/verify_vhost_includes to check the new includes are working
[]# /scripts/verify_vhost_includes
If all looks ok run /scripts/ensure_vhost_includes ––user=username
[]# /scripts/ensure_vhost_includes ––user=username
This will restart apache as well and all should be good to go… run phpinfo(); on your domain to insure changes are reflected…