Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using Debian Squeeze and set up PHP-FPM with fastcgi. I have several virtual hosts defined on the same host. I defined chroot for each pool configuration but somehow it is possible to change directory and go above the root directory definition at the pool conf.

disable_functions at the conf file is not working as well. I haven't figured it out the reason.

Samle files are below:

/etc/php5/fpm/pool.d/foo.conf:

[foo]

user = foo
group = foo

listen = 127.0.0.1:9018
listen.allowed_clients = 127.0.0.1

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

chroot = /var/www/foo
chdir = /

php_admin_value[disable_functions] = dir,chdir,opendir,readdir

/etc/apache2/sites-enables/foo.com:

<VirtualHost 19x.xxx.xxx.xx>
DocumentRoot /var/www/foo
ServerName foo.com

<IfModule mod_fastcgi.c>

    FastCgiExternalServer /foocgi/php5-wrapper -host 127.0.0.1:9018

    ScriptAlias /foocgi/ /var/www/foo/cgi-bin/

    AddHandler php5-fastcgi .php
    Action php5-fastcgi /foocgi/php5-wrapper
    AddType application/x-httpd-php .php

    <Directory /var/www/foo/cgi-bin/>
         SetHandler fastcgi-script
        Options +ExecCGI
    </Directory>

</IfModule>

<Directory /var/www/foo>
allow from all
Options -Indexes SymLinksIfOwnerMatch
</Directory>
</VirtualHost>

/var/www/ybm/cgi-bin/php5-wrapper:

#!/bin/sh
PHPRC=/etc/php5/cgi/
export PHPRC
#export PHP_FCGI_MAX_REQUESTS=5000
#export PHP_FCGI_CHILDREN=8
exec /usr/lib/cgi-bin/php

/etc/apache2/mods-enabled/fastcgi.conf:

<IfModule mod_fastcgi.c>
 FastCgiConfig -minProcesses 5 -maxProcesses 100

 <Directory "/var/www/cgi-bin/">
        AllowOverride none
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
  </Directory>
</IfModule>
share|improve this question
    
prorbaly you'll need to configure each php-pool with open_basedir line –  Andrei Mikhaltsov Jun 21 '13 at 9:19
    
i added the below ones to the pool configuration: php_admin_value[doc_root] = /var/www/foo php_admin_value[open_basedir] = /var/www/foo and no effect. Should i change the cgi.fix_pathinfo to 0 or 1 also? –  ogzy Jun 21 '13 at 12:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.