View previous topic :: View next topic |
Author |
Message |
KWhat l33t
Joined: 04 Sep 2005 Posts: 647 Location: Los Angeles
|
Posted: Wed Feb 09, 2011 12:29 am Post subject: Problems with mod_fastcgi and apache2 [SOLVED] |
|
|
The Error:
Code: | FastCGI: invalid (dynamic) server "/var/www/htdocs/index.php": access for server (uid 81, gid 81) not allowed: execute not allowed |
The Config:
Code: |
FastCgiWrapper Off
FastCgiIpcDir /var/run/fastcgi
FastCgiConfig -maxClassProcesses 5 -maxProcesses 1000 -restart -killInterval 10
FastCgiServer /usr/bin/php-cgi -socket /var/run/fastcgi/fastcgi.socket -processes 1 -initial-env PHPRC=/etc/php/cgi-php5.3
AddHandler fastcgi-script .php
|
I think apache is trying to execute /var/www/htdocs/index.php as a shell script instead of passing it to /usr/bin/php-cgi which appears to start correctly.
Last edited by KWhat on Thu Feb 10, 2011 1:14 am; edited 1 time in total |
|
Back to top |
|
|
Dagger Retired Dev
Joined: 11 Jun 2003 Posts: 765 Location: UK
|
Posted: Wed Feb 09, 2011 12:45 pm Post subject: |
|
|
if you want to use apache with fastcgi, why not to use php-fpm? It was designed to be used with mod_fastcgi. _________________ 95% of all computer errors occur between chair and keyboard (TM)
Join the FSF as an Associate Member!
Post under CC license. |
|
Back to top |
|
|
KWhat l33t
Joined: 04 Sep 2005 Posts: 647 Location: Los Angeles
|
Posted: Wed Feb 09, 2011 9:24 pm Post subject: |
|
|
Thats the end goal, I would just like to see if i can get fastcgi working by its self first. This configuration was a pain but I think I finally got it working. I have attached a few spinets for each configuration in hopes that it will be useful for someone at some point.
/etc/apache2/modules.d/20_mod_fastcgi.conf
Code: |
<IfDefine FASTCGI>
LoadModule fastcgi_module modules/mod_fastcgi.so
FastCgiWrapper Off
FastCgiIpcDir /var/run/fastcgi
FastCgiConfig -maxClassProcesses 4 -maxProcesses 10000 -restart -killInterval 10
FastCgiServer /usr/bin/php-cgi -socket /var/run/fastcgi/fastcgi.socket -processes 1 -initial-env PHPRC=/etc/php/cgi-php5.3
AddHandler php-fastcgi .php
Action php-fastcgi /cgi-bin/php-fastcgi
<Location /cgi-bin/php-fastcgi>
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
SetHandler fastcgi-script
Options +ExecCGI
</Location>
AddType application/x-httpd-php .php
DirectoryIndex index.php
</IfDefine>
|
/etc/apache2/modules.d/20_mod_fpm.conf
Code: |
<IfDefine FPM>
LoadModule fastcgi_module modules/mod_fastcgi.so
#FastCgiWrapper Off
#FastCgiIpcDir /var/run/fastcgi
#FastCgiConfig -maxClassProcesses 4 -maxProcesses 10000 -restart -killInterval 10
#FastCgiServer /usr/bin/php-cgi -socket /var/run/fastcgi/fastcgi.socket -processes 1 -initial-env PHPRC=/etc/php/cgi-php5.3
AddHandler php-fpm .php
Action php-fpm /cgi-bin/php-fpm
<Location /cgi-bin/php-fpm>
Order Deny,Allow
Deny from All
# Prevent accessing this path directly
Allow from env=REDIRECT_STATUS
SetHandler fpm-script
Options +ExecCGI
</Location>
AddType application/x-httpd-php .php
DirectoryIndex index.php
</IfDefine>
|
/etc/apache2/vhosts.d/00_http_siteroot.conf
Code: |
...
DocumentRoot "/var/www/siteroot/htdocs"
# Directive to enabled FASTCGI PHP
<IfDefine FASTCGI>
ScriptAlias /cgi-bin/ /var/www/siteroot/htdocs/
FastCgiExternalServer /var/www/siteroot/htdocs/php-fastcgi -socket /var/run/fastcgi/fastcgi.socket
</IfDefine>
# Directive to enabled FPM PHP
<IfDefine FPM>
ScriptAlias /cgi-bin/ /var/www/siteroot/htdocs/
FastCgiExternalServer /var/www/siteroot/htdocs/php-fpm -socket /var/run/php-fpm.socket
</IfDefine>
...
|
Note: The cgi-bin folder and the php-fastcgi / php-fpm files do not exist on the filesystem. |
|
Back to top |
|
|
kosovafan n00b
Joined: 26 Feb 2011 Posts: 23
|
Posted: Sat Feb 26, 2011 1:05 pm Post subject: |
|
|
Hello,
thats a configuration what i search. Only one question, how can use FPM for Virtuelle Server?
Great when someone can help.
Regards
Silvio |
|
Back to top |
|
|
KWhat l33t
Joined: 04 Sep 2005 Posts: 647 Location: Los Angeles
|
Posted: Wed Mar 02, 2011 4:46 am Post subject: |
|
|
Quote: | how can use FPM for Virtuelle Server? |
That configuration snip-it should be all you need to use it in a virtual host configuration with apache. Make sure you add -D FPM to APACHE2_OPTS= in your /etc/conf.d/apache2 folder.
This goes in the virtual host:
Code: |
<VirtualHost *:80>
ServerName www.myhost.com
...
# Directive to enabled FPM PHP
<IfDefine FPM>
ScriptAlias /cgi-bin/ /var/www/siteroot/htdocs/
FastCgiExternalServer /var/www/siteroot/htdocs/php-fpm -socket /var/run/php-fpm.socket
</IfDefine>
DocumentRoot "/var/www/siteroot/htdocs"
<Directory /var/www/siteroot/htdocs>
...
</Directory>
</VirtualHost>
|
|
|
Back to top |
|
|
|