Custom php.ini File in cPanel

In this example I will be creating a custom php.ini file in my WordPress website which runs on a cPanel server using SuPHP. I will also be turning off PHP display errors as a test.

 

1) Create your php.ini file in your public_html folder and add the following:

# vi /home/jordansphere/public_html/php.ini

display_errors = Off

 

 

2) Edit the .htaccess file in the public_html folder and add the following 

# vi /home/jordansphere/public_html/.htaccess

<IfModule mod_suphp.c>
suPHP_ConfigPath /home/jordansphere/public_html
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>

You can then check this is working by using using PHP Info. WordPress users can add a plugin for ease. I used WordPress PHPinfo().