简体   繁体   English

PHP-FPM 未按预期工作

[英]PHP-FPM is not working as expected

I am using Debian Squeeze and set up PHP-FPM with fastcgi.我正在使用 Debian Squeeze 并使用 fastcgi 设置 PHP-FPM。 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.我为每个池配置定义了 chroot 但不知何故有可能更改目录并在池 conf 的根目录定义之上。

disable_functions at the conf file is not working as well. conf 文件中的 disable_functions 也无法正常工作。 I haven't figured it out the reason.我还没弄明白原因。

Sample files are below:示例文件如下:

/etc/php5/fpm/pool.d/foo.conf: /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: /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/foo/cgi-bin/php5-wrapper: /var/www/foo/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: /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 is empty though port 9018 is LISTEN at netstat output. /var/log/foo.access.log 是空的,尽管端口 9018 在 netstat 输出中被监听。 The site is being opened without errors also.该网站正在打开也没有错误。 Any idea about the chroot problem or how to make the disable_functions work?关于 chroot 问题或如何使 disable_functions 工作的任何想法?

Can you show your phpinfo() ?你能显示你的phpinfo()吗?

May you load PHP.ini from /etc/php5/cgi/php.ini and from your php-fpm config, from pool.d/* or from /etc/php5/fpm/php.ini你可以从 /etc/php5/cgi/php.ini 和你的 php-fpm 配置,从 pool.d/* 或从 /etc/php5/fpm/php.ini 加载 PHP.ini

I say that for:我这样说是为了:

#!/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

php5-fpm is usually in /usr/sbin/php5-fpm php5-fpm 通常在 /usr/sbin/php5-fpm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM