Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problems with mod_fastcgi and apache2 [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
KWhat
Guru
Guru


Joined: 04 Sep 2005
Posts: 563
Location: Los Angeles

PostPosted: Wed Feb 09, 2011 12:29 am    Post subject: Problems with mod_fastcgi and apache2 [SOLVED] Reply with quote

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
View user's profile Send private message
Dagger
Retired Dev
Retired Dev


Joined: 11 Jun 2003
Posts: 765
Location: UK

PostPosted: Wed Feb 09, 2011 12:45 pm    Post subject: Reply with quote

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
View user's profile Send private message
KWhat
Guru
Guru


Joined: 04 Sep 2005
Posts: 563
Location: Los Angeles

PostPosted: Wed Feb 09, 2011 9:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
kosovafan
n00b
n00b


Joined: 26 Feb 2011
Posts: 22

PostPosted: Sat Feb 26, 2011 1:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
KWhat
Guru
Guru


Joined: 04 Sep 2005
Posts: 563
Location: Los Angeles

PostPosted: Wed Mar 02, 2011 4:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum