PHP-FPM没有按预期工作

时间:2013-06-22 13:15:06

标签: apache2 debian fastcgi php

我正在使用Debian Squeeze并使用fastcgi设置PHP-FPM。我在同一主机上定义了几个虚拟主机。我为每个池配置定义了chroot,但不知何故可以更改目录并在pool conf上的根目录定义之上。

conf文件中的

disable_functions也不起作用。我没想出原因。

示例文件如下:

/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
php_admin_value[doc_root] = /var/www/foo
php_admin_value[open_basedir] = /var/www/foo

access.log = /var/log/$pool.access.log
access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"

/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 -user foouser -group foogroup


    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 /富/的cgi-bin / PHP5-包装:

#!/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 -autoUpdate -singleThreshold 100 -killInterval 300 -idle-timeout 240 -maxClassProcesses 1 -pass-header HTTP_AUTHORIZATION
 FastCgiWrapper /usr/lib/apache2/suexec

 <Directory "/var/www/cgi-bin/">
        AllowOverride none
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
  </Directory>
</IfModule>

/var/log/foo.access.log为空,但端口9018在netstat输出处是LISTEN。该网站也正在打开而没有错误。有关chroot问题或如何使disable_functions工作的任何想法?

1 个答案:

答案 0 :(得分:0)

你能展示你的php信息()

可以从/etc/php5/cgi/php.ini和php-fpm配置,pool.d / *或/etc/php5/fpm/php.ini

加载PHP.ini

我这样说:

!/ bin / sh的

PHPRC =的/ etc / PHP5 / CGI / 出口PHPRC

导出PHP_FCGI_MAX_REQUESTS = 5000

导出PHP_FCGI_CHILDREN = 8

exec / usr / lib / cgi-bin / php

php5-fpm通常位于/ usr / sbin / php5-fpm

但也许我失败了因为我的英语非常糟糕:/