Engrost
Engrost

Reputation: 799

fastcgi does not work - wrapper dowloaded not run

On my fresh Ubuntu 8.04

I installed virtualmin. Then I set up fastcgi as I did on my other server (Debian). Bu I have small problem. When I open website It instead of running fastcgi wrapper it downloads it. Here is config:

<IfModule mod_fastcgi.c>
    FastCgiIpcDir /usr/lib/apache2/fastcgi
    AddHandler fastcgi-script .fcgi
    FastCgiWrapper /usr/local/sbin/suexec
    FastCgiConfig -singleThreshold 1 -autoUpdate -idle-timeout 240 -pass-header HTTP_AUTHORIZATION
</IfModule>

website.conf:

   SuexecUserGroup "#1002" "#1003"  
   DocumentRoot /home/przepisy/public_html  
   ScriptAlias /php-fastcgi/ /home/przepisy/php-fastcgi/  
   AddHandler php-fastcgi .php  
   AddType application/x-httpd-php .php  
   Action php-fastcgi /php-fastcgi/php5-fcgi  
   DirectoryIndex index.html index.php  
   <Directory /home/przepisy/public_html>  
    Options -Indexes +ExecCGI FollowSymLinks  
    allow from all  
    AllowOverride All  
   </Directory>  

/home/przepisy/php-fastcgi/php5-fcgi

#!/bin/sh 
PHPRC="/home/przepisy/conf/" 
export PHPRC 
PHP_FCGI_CHILDREN=4 
export PHP_FCGI_CHILDREN 
PHP_FCGI_MAX_REQUESTS=200 
export PHP_FCGI_MAX_REQUESTS 
exec /usr/bin/php5-cgi 

So If I access website it gives it random name and when I look at downloaded contents it shows php5-fcgi contents. When I specify php script eg index.php it opts to save and shows contents of php5-fcgi... I'm dunno at this stage. This config worked on Debian no problems...

Upvotes: 1

Views: 7483

Answers (1)

blt04
blt04

Reputation: 692

You need to add a section that tells Apache to use mod_fastcgi to execute your php5-fcgi script using FastCGI. Try adding this to your website.conf:

<Location "/php-fastcgi/php5-fcgi">
   Order Deny,Allow
   Deny from All
   Allow from env=REDIRECT_STATUS
   Options ExecCGI
   SetHandler fastcgi-script      
</Location>

The SetHandler fastcgi-script part tells Apache to use mod_fastcgi when executing your php5-fcgi script. The Allow from env=REDIRECT_STATUS prevents visitors from downloading your php5-fcgi script directly by accessing http://mydomain.com/php-fastcgi/php5-fcgi.

Also, I use

FastCgiWrapper On

instead of the suexec binary you listed in your example. My Apache is compiled with SuEXEC support and I use SuexecUserGroup as you do. My SuEXEC works with this configuration - might be worth trying.

And of course I'm sure you've already checked, but make sure you have:

LoadModule fastcgi_module modules/mod_fastcgi.so

somewhere in your Apache configuration.

Upvotes: 3

Related Questions