Are you trying to set custom php.ini in FastCGI?
This guide will help you.
When using FastCGI (FCGI) as the loader for PHP, traditional phpvalues in the .htaccess file as well as custom php.ini files in the publichtml directory no longer work.
Most of the domains move to PHP nowadays. In a shared server, all of us want to set the PHP parameter according to the feasibility of domains.
In such a case, custom PHP plays an important role.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform FastCGI queries.
In this context, we shall look into how to set custom php.ini in FastCGI.
Importance of Custom php.ini
With custom PHP, according to our requirements, we can set features like 'maximum upload file size, maximum execution time' and so on.
Among the PHP handlers, in a shared server, due to a lack of resources, FastCGI is the best to manage resources for a high traffic site.
Moving ahead, our Support Experts show how to set custom PHP in 'FastCGI' as a PHP handler.
How to Set custom php.ini in FastCGI ?
To set a custom "php.ini" for the "FastCGI" PHP handler a few settings are to be done in the server.
Initially, we check the current PHP handler for the server:
# /usr/local/cpanel/bin/rebuild_phpconf –current Available handlers
If it is "FastCGI", we proceed with the below-given steps to enable custom "php.ini":
1. Open the ".htaccess" file for the domain and add the below codes:
AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/php5.fcgi
2. Then, move the php.ini file to the cgi-bin folder of the account and also change the permission of the file to "755".
3. Add the below-given code to the "cgi-bin" directory which is present inside the "public_html" file of the domain:
exec /usr/local/cpan el/cgi-sys/php5
4. Eventually, save and quit the file.
5. Then change the permission of the file "/home/user/public_html/cgi-bin/php5.fcgi" to 755.
Now, we have a custom PHP for our domain. Once this is done, we can set different PHP parameters.
For example, if want to install Drupal, we need to set the PHP parameter "Memory Limit" as 64MB which helps seamless installation of Drupal in our domain.
Though there is a never-ending stream of things to do, if we take care of the steps above, we can perform the task easily.