The following steps will help you create a custom php.ini file for a cPanel account when using CGI or FCGI as the PHP handler.
Enter to the cgi folder.
cd /home/user/public-html/cgi-bin
Copy the php.ini to that folder
cp /usr/local/lib/php.ini /home/user/public_html/cgi-bin
Open the php.ini
vi php.ini
Change the PHP variable
For Example: register_globals = On
Create php.cgi (under the /home/user/public-html/cgi-bin folder) file to load custom php.ini, with the following content:
#!/bin/sh /usr/local/cpanel/cgi-sys/php5 -c /home/user/public_html/cgi-bin/
Please note the path to php5 is due to using PHP5 on this system. If you are using php4, it might be /usr/local/cpanel/cgi-sys/php4 or some other path. Check /etc/httpd/conf/php.conf to see what it shows for the cgi-sys path for your version of PHP.
Save the file, then made executable:
chmod +x /home/user/public_html/cgi-bin/php.cgi
Change ownership of files to correct user:
chown -R user:user /home/user/public_html/cgi-bin/
Go to the document root and edit .htaccess to point to php.cgi wrapper
cd /home/user/public_html vi .htaccess
Put the code given below at the top of the file:
Action application/x-httpd-php5 /cgi-bin/php.cgi
Again, here php5 is listed. If your PHP is different, use the Action listed for your version of PHP in /etc/httpd/conf/php.conf file.
So that’s how you create a custom php.ini file when the handler is CGI or FCGI in cPanel.