我们如何停止在 Apache 上使用 php-fpm?

我们如何停止在 Apache 上使用 php-fpm?

我们如何停止在 Apache 上使用 php-fpm?我试图让服务器运行,问题是它在 CENTOS 6 上运行,而 puppet 仅在 CENTOS 6 上运行。我试图弄清楚为什么在我复制设置后服务器没有运行,然后我做了:

sudo netstat -plnt

这表明我正在使用 php-fpm,而它工作的服务器上并没有运行它。我很困惑,因为上次检查时 httpd 配置是一样的,所以我想知道如何从 php-fpm 切换到 php,看看我是否可以在新服务器上运行 Apache。我把它关掉了:

sudo service php-fpm stop

但我仍然从 varnish 获得 500。我不确定我是否错过了 httpd 配置中的某些内容,但新旧服务器的配置几乎相同。

我有一个 php.conf:

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
  LoadModule php7_module modules/libphp7.so
</IfModule>

<IfModule !prefork.c>
  LoadModule php7_module modules/libphp7-zts.so
</IfModule>

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php7-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps

#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path    "/var/lib/php/session"
php_value soap.wsdl_cache_dir  "/var/lib/php/wsdlcache"

以及 fast_cgi 配置:

# WARNING: this is a kludge:
## The User/Group for httpd need to be set before we can load mod_fastcgi,
## but /etc/httpd/conf.d/fastcgi.conf on RHEL gets loaded before
## /etc/httpd/conf/httpd.conf, so we need to set them here :(
## mod_fcgid does not have this bug,
## but it does not handle child PHP processes appropriately per
## http://serverfault.com/questions/303535/a-single-php-fastcgi-process-blocks-all-other-php-requests/305093#305093
User apache
Group apache

LoadModule fastcgi_module modules/mod_fastcgi.so

# dir for IPC socket files

FastCgiIpcDir /var/run/mod_fastcgi

# wrap all fastcgi script calls in suexec

FastCgiWrapper Off

# global FastCgiConfig can be overridden by FastCgiServer options in vhost config

FastCgiConfig -idle-timeout 120 -maxClassProcesses 1

# sample PHP config
# see /usr/share/doc/mod_fastcgi-2.4.6 for php-wrapper script
# don't forget to disable mod_php in /etc/httpd/conf.d/php.conf!
#
# to enable privilege separation, add a "SuexecUserGroup" directive
# and chown the php-wrapper script and parent directory accordingly
# see also http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/
#
#FastCgiServer /var/www/cgi-bin/php-wrapper
#AddHandler php-fastcgi .php
#Action php-fastcgi /cgi-bin/php-wrapper
#AddType application/x-httpd-php .php
#DirectoryIndex index.php
#
#<Location /cgi-bin/php-wrapper>
#    Order Deny,Allow
#    Deny from All
#    Allow from env=REDIRECT_STATUS
#    Options ExecCGI
#    SetHandler fastcgi-script
#</Location>

以及一个 fcgi 配置:

<IfModule mod_fastcgi.c>
    Alias /php5-fcgi-staging03 /usr/lib/cgi-bin/php5-fcgi-staging03
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi-staging03 -socket /var/run/php-fpm/php5-fcgi-staging03.sock -pass-header Authorization -idle-timeout 300
</IfModule>

注释掉 php5-fcgi-staging03 会给我:

Not Found
The requested URL /php5-fcgi-staging03/index.php was not found on this server.

相关内容