How to setup custom PHP.INI when the handler is fcgi
# cd /home/user/public-html/cgi-bin
#cp /usr/local/lib/php.ini /home/user/public_html/cgi-bin
Create an empty file php.fcgi
#vi php.fcgi
#!/bin/sh
#export PHP_FCGI_CHILDREN=1
#export PHP_FCGI_MAX_REQUESTS=10
#exec /usr/local/cpanel/cgi-sys/php5
Note :- PHP_FCGI_CHILDREN
The number of running children is controlled by the PHP_FCGI_CHILDREN variable. If this is set to 0, then PHP will not fork a process manager but instead run only as a worker thread.
PHP_FCGI_MAX_REQUESTS
To set worker children to exit after that many requests.
exec /usr/local/cpanel/cgi-sys/php5 --> Set execute the fcgiwrapper.
Open phpconfiguration file "/usr/local/apache/conf/php.conf" and check for the fcgi wrapper file for each of the PHP types.
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5 --> For PHP version 5
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4 --> For PHP version 4
Now, make php.fcgi file executable and correct the ownership,
chmod +x /home/user/public_html/cgi-bin/php.fcgi
chown -R user:user /home/user/public_html/cgi-bin/
Now, open .htaccess file under the user home directory and add the below contents,
#AddHandler php5-fastcgi .php
#Action php5-fastcgi /cgi-bin/php.fcgi
The above indicates that when a file with extension .php comes this should be handled by the executable. " /cgi-bin/php.fcgi"
Now, add the content type for php5-fastcgi and Action in global php configuration file /usr/local/apache/conf/php.conf as below,
=-=-=-=-
#Action php5-fastcgi /cgi-bin/php.fcgi
#AddType application/x-httpd-php .php
=-=-=-=-
Now restart apache
Under the public_html, put a php info page. The loaded PHP.INI will be in,
=-=-=-
/home/user/public_html/cgi-bin/php.ini
=-=-=-
Done
# cd /home/user/public-html/cgi-bin
#cp /usr/local/lib/php.ini /home/user/public_html/cgi-bin
Create an empty file php.fcgi
#vi php.fcgi
#!/bin/sh
#export PHP_FCGI_CHILDREN=1
#export PHP_FCGI_MAX_REQUESTS=10
#exec /usr/local/cpanel/cgi-sys/php5
Note :- PHP_FCGI_CHILDREN
The number of running children is controlled by the PHP_FCGI_CHILDREN variable. If this is set to 0, then PHP will not fork a process manager but instead run only as a worker thread.
PHP_FCGI_MAX_REQUESTS
To set worker children to exit after that many requests.
exec /usr/local/cpanel/cgi-sys/php5 --> Set execute the fcgiwrapper.
Open phpconfiguration file "/usr/local/apache/conf/php.conf" and check for the fcgi wrapper file for each of the PHP types.
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php5 --> For PHP version 5
FCGIWrapper /usr/local/cpanel/cgi-sys/php5 .php4 --> For PHP version 4
Now, make php.fcgi file executable and correct the ownership,
chmod +x /home/user/public_html/cgi-bin/php.fcgi
chown -R user:user /home/user/public_html/cgi-bin/
Now, open .htaccess file under the user home directory and add the below contents,
#AddHandler php5-fastcgi .php
#Action php5-fastcgi /cgi-bin/php.fcgi
The above indicates that when a file with extension .php comes this should be handled by the executable. " /cgi-bin/php.fcgi"
Now, add the content type for php5-fastcgi and Action in global php configuration file /usr/local/apache/conf/php.conf as below,
=-=-=-=-
#Action php5-fastcgi /cgi-bin/php.fcgi
#AddType application/x-httpd-php .php
=-=-=-=-
Now restart apache
Under the public_html, put a php info page. The loaded PHP.INI will be in,
=-=-=-
/home/user/public_html/cgi-bin/php.ini
=-=-=-
Done