Apache, PHP, suexec and FastCGI
Miguel Saturnino <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <1110238534.10197.3.camel@localhost> |
Hi all!
I'm trying to get PHP+SuExec+FastCGI to work with Apache (so that PHP
runs with the user's permissions and not the Web Server's permissions)
with no luck so far...
I've build Apache with suexec support, installed mod_fastgi and built
php as fast-cgi:
root@furao # /usr/local/bin/phpfcgi -v
PHP 4.3.10 (cgi-fcgi) (built: Mar 7 2005 20:49:09)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
My httpd.conf:
(...)
LoadModule fastcgi_module libexec/apache/mod_fastcgi.so
(...)
AddModule mod_fastcgi.c
(...)
<VirtualHost test.pt>
User miguel
Group miguel
ServerAdmin [email protected]
DocumentRoot /usr/home/miguel/httpdocs/test.pt
ServerName test.pt
ErrorLog logs/test.pt-error_log
CustomLog logs/test.pt-access_log common
</VirtualHost>
FastCgiWrapper /usr/local/sbin/suexec
FastCgiServer /usr/home/miguel/httpdocs/encontra-me.org/cgi-bin/php \
-user www -group www
AddHandler php-fastcgi .php
<Location /cgi-bin/php>
SetHandler fastcgi-script
</Location>
Action php-fastcgi /cgi-bin/php
AddType application/x-httpd-php .php
root@furao # ls -l /home/miguel/httpdocs/encontra-me.org/cgi-bin/php
-rwxr-xr-x 1 miguel miguel 128 7 Mar 20:27
/home/miguel/httpdocs/encontra-me.org/cgi-bin/php
root@furao # more /home/miguel/httpdocs/encontra-me.org/cgi-bin/php
#!/bin/sh
PHPRC="/usr/local/etc/php.ini"
export PHPRC
PHP_FCGI_CHILDREN=4
export PHP_FCGI_CHILDREN
exec /usr/local/bin/phpfcgi
Apache error log:
root@furao # tail /var/log/httpd-error.log
(...)
[Mon Mar 7 23:10:45 2005] [notice] SIGUSR1 received. Doing graceful
restart
Warning: User directive in <VirtualHost> requires SUEXEC wrapper.
Warning: Group directive in <VirtualHost> requires SUEXEC wrapper.
[Mon Mar 7 23:10:45 2005] [alert] httpd: Could not determine the server's
fully qualified domain name, using 127.0.0.1 for ServerName
[Mon Mar 7 23:10:45 2005] [notice] FastCGI: wrapper mechanism enabled
(wrapper: /usr/local/sbin/suexec)
[Mon Mar 7 23:10:45 2005] [notice] FastCGI: process manager initialized
(pid 10101)
[Mon Mar 7 23:10:46 2005] [notice] Apache/1.3.33 (Unix) mod_fastcgi/2.4.2
configured -- resuming normal operations
[Mon Mar 7 23:10:46 2005] [notice] Accept mutex: flock (Default: flock)
Now, when I try to access a PHP web page I get a 403 Forbiden Error (even if
the file doesn't exist) and the request URL is changed from abc.php to
/cgi-bin/php/abc.php. For example, if I try to acess http://test.pt/phpinfo.php
I get this error message:
Not Found
The requested URL /cgi-bin/php/phpinfo.php was not found on this
server.
Apache/1.3.33 Server at test.pt Port 80
What am I doing wrong?
TIA!
Regards,
--
Miguel Saturnino <[email protected]>
___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/