Apache worker module+ php-cgi+fcgid
These are the set of commands I issued:
1. apt-get -u install php5-cgi libapache2-mod-fcgid apache2-mpm-worker
2. a2dismod php5 (disable php5)
3. Enable the ‘actions‘ and ‘fcgid‘ Apache mods (e.g. a2enmod fcgid and a2enmod actions)
4. Edited /etc/apache2/mods-enabled/fcgid.conf and bumped the “IPCCommTimeout” up to 60 from the default of 20
5. Created a /etc/apache2/conf.d/php-fcgid.conf file with the contents
DefaultInitEnv PHPRC=/etc/php5/cgi
Number of PHP childs that will be launched. Leave undefined to let PHP decide.
DefaultInitEnv PHPFCGICHILDREN 3
Maximum requests before a process is stopped and a new one is launched
DefaultInitEnv PHPFCGIMAX_REQUESTS 5000
Define a new handler "php-fcgi" for ".php" files, plus the action that must follow
AddHandler php-fcgi .php
Action php-fcgi /fcgi-bin/php-fcgi-wrapper
Define the MIME-Type for ".php" files
AddType application/x-httpd-php .php
Define alias "/fcgi-bin/". The action above is using this value, which means that
you could run another "php5-cgi" command by just changing this alias
Alias /fcgi-bin/ /var/www/fcgi-bin.d/php5-default/
Turn on the fcgid-script handler for all files within the alias "/fcgi-bin/"
Options +ExecCGI
6. create the directory which is chosen by the alias, and put in a symlink to the php5-cgi binary
mkdir /var/www/fcgi-bin.d/php5-default
ln -s /usr/bin/php5-cgi /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper
7. Restart Apache —
–-----------------------------------------------------------
The wordpress site now is not opening and gives an internal failure:
The error log returns
"Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration"
What am I doing wrong?
Any help will be appreciated.
many thanks
3 Replies
Now the error is:
You don't have permission to access /fcgi-bin/php-fcgi-wrapper/index.php on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
–-------------------------------------
Checking the error log:
Symbolic link not allowed or link target not accessible: /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper
I went back and reissued the symbolic linkl creation:
mkdir /var/www/fcgi-bin.d/php5-default
ln -s /usr/bin/php5-cgi /var/www/fcgi-bin.d/php5-default/php-fcgi-wrapper
Let me know if you can see anything wrong….
thanks again.
Did you ever figure out what the issue was?
I too am getting the 403 Forbidden error client-side and the Symbolic link not allowed or link target not accessible error in the Apache log.
I call myself checking permissions, etc.
Here is what I have:
php-fcgid.conf
# Enable PHP in vhosts instead
#AddHandler fcgid-script .fcgi .php
AddHandler fcgid-script .fcgi
# Where to look for the php.ini file?
DefaultInitEnv PHPRC "/etc/php5/cgi"
# Maximum requests a process handles before it is terminated
MaxRequestsPerProcess 1000
# Maximum number of PHP processes
MaxProcessCount 10
# Number of seconds of idle time before a process is terminated
IPCCommTimeout 240
IdleTimeout 240
FCGIWrapper /usr/bin/php-cgi .php
My vhost file:
<directory var="" www="" domain=""><filesmatch "\.ph(p3?|tml|ps)$"="">AddHandler fcgid-script .php
Options +ExecCGI</filesmatch></directory>
The FilesMatch part could be stripped out to leave:
<directory var="" www="" domain="">AddHandler fcgid-script .php
Options +ExecCGI</directory>
I removed .fcgi from the AddHandler directive, as I don't plan on using files with that extension on this particular vhost, but added back you have:
<directory var="" www="" domain="">AddHandler fcgid-script .fcgi .php
Options +ExecCGI</directory>
References: