Max Bowsher wrote:

>>> Quoting Ivan Ristic <ivanr webkreator com> (2004-11-17 17:31:39 GMT):
>>>
>>>>  I've used FastCGI to give individual
>>>>  users their own PHP engines (since PHP now comes with FastCGI protocol
>>>>  support built-in).
> 
> 
> This sounds useful - would you be willing to share some config file
> samples?

  Sure:

---
LoadModule fastcgi_module modules/mod_fastcgi.so
FastCgiWrapper /usr/local/apache/bin/suexec

# This configuration will recycle persistent processes once every
# 300 seconds, and make sure no processes run unless there is
# a need for them to run.
FastCgiConfig -singleThreshold 100 -minProcesses 0 -killInterval 300

NameVirtualHost *
<VirtualHost *>
    ServerName ivanr.example.com
    DocumentRoot /home/ivanr/public_html
    SuexecUserGroup ivanr ivanr

    AddHandler application/x-httpd-php .php
    Action application/x-httpd-php /fastcgi-bin/php

    # this is a normal CGI folder
    <Directory /home/ivanr/public_html/cgi-bin>
        Options +ExecCGI
        SetHandler cgi-script
    </Directory>

    <Directory /home/ivanr/public_html/fastcgi-bin>
        Options +ExecCGI
        SetHandler fastcgi-script
    </Directory>
</VirtualHost>
---

A copy of PHP that is FastCGI-aware should be placed at
/home/ivanr/public_html/fastcgi-bin/php (compile PHP as CGI and
--enable-fastcgi). PHP will tell you whether it understands FastCGI
or not when invoked directly:

# /home/ivanr/public_html/fastcgi-bin/php -v
PHP 5.0.2 (cgi-fcgi) (built: Nov 19 2004 11:09:11)

If a php.ini file is present in the same location it will be picked up
automatically, thus allowing each user to configure their PHP instance
as they're pleased.

Once you get it up and running (suEXEC is a pain, as usual), tail the
suexec log to make sure PHP is started only once, and that all
subsequent invocations are handled by the persistent instance
(obviously, nothing appears in the suexec log).

-- 
ModSecurity (http://www.modsecurity.org)
[ Open source IDS for Web applications ]

Reply via email to