Apache FastCGI PHP中的FastCgiExternalServer和FastCgiServer之间的区别? [英] Difference between FastCgiExternalServer and FastCgiServer in Apache FastCGI PHP?

查看:202
本文介绍了Apache FastCGI PHP中的FastCgiExternalServer和FastCgiServer之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请允许我声明我是FastCGI的新手.我在OS X机器上安装了MAMP的Apache.默认的PHP处理程序为Apache Handler 2.0(libphp5.so).我想更改为FastCGI并遵循以下答案:

Just let me state that I am new to FastCGI. I have MAMP's Apache on my OS X machine. Default PHP handler was Apache Handler 2.0 (libphp5.so). I wanted to change to FastCGI and followed the answer here: How to configure Apache to run PHP as FastCGI on Ubuntu 12.04 via terminal?

我在httpd.conf的末尾添加了以下内容:

I added the following at the end of my httpd.conf:

<IfModule mod_fastcgi.c>
   AddHandler php5.fcgi .php
   Action php5.fcgi /php5.fcgi
   Alias /php5.fcgi /Applications/MAMP/fcgi-bin/php5.fcgi
   FastCgiServer /Applications/MAMP/fcgi-bin/php5.fcgi -socket /Applications/MAMP/tmp/php-fcgi/php5-fpm.sock -pass-header Authorization -idle-timeout 3600
   #FastCgiExternalServer /Applications/MAMP/fcgi-bin/php5.fcgi -socket /Applications/MAMP/tmp/php-fcgi/php5-fpm.sock -pass-header Authorization -idle-timeout 3600
   <Directory /Applications/MAMP/fcgi-bin>
       Order allow,deny
         Allow from all
   </Directory> 
</IfModule>

但是,如您所见,FastCgiExternalServer已被注释掉.相反,我不得不使用FastCgiServer原因,否则Apache在尝试请求页面时会给我以下错误:

However, as you can see, FastCgiExternalServer is commented out. Instead, I had to use FastCgiServer cause otherwise Apache was giving me the following errors when trying to request a page:

[2016年5月6日星期五23:25:22] [错误] [客户端:: 1](2)没有这样的文件或目录:FastCGI:无法连接到服务器"/Applications/MAMP/fcgi-bin/php5.fcgi":connect()失败

[Fri May 06 23:25:22 2016] [error] [client ::1] (2)No such file or directory: FastCGI: failed to connect to server "/Applications/MAMP/fcgi-bin/php5.fcgi": connect() failed

[2016年5月6日星期五23:25:22] [错误] [客户端:: 1] FastCGI:从服务器"/Applications/MAMP/fcgi-bin/php5.fcgi"接收到不完整的标头(0字节)

[Fri May 06 23:25:22 2016] [error] [client ::1] FastCGI: incomplete headers (0 bytes) received from server "/Applications/MAMP/fcgi-bin/php5.fcgi"

但是/Applications/MAMP/fcgi-bin/php5.fcgi存在,其内容为:

#!/bin/bash
PHP_CGI=/Applications/MAMP/bin/php/php5.6.2/bin/php-cgi
exec $PHP_CGI

FastCgiServerFastCgiExternalServer有什么区别?为什么FastCgiExternalServer在我的情况下不起作用,但FastCgiServer起作用?

What's the difference between FastCgiServer and FastCgiExternalServer and why FastCgiExternalServer didn't work in my case but FastCgiServer worked?

推荐答案

FastCgiServer是mod_fastcgi将对其进行进程管理的服务器-向上和向下旋转实例,并为它们提供一个unix域套接字以供侦听.无需外部操作即可启动fastcgi服务器.

FastCgiServer is a server that mod_fastcgi will do process management for -- spinning instances up and down and giving them a unix domain socket to listen on. No outside action is required to start the fastcgi server.

FastCgiExternalServer是mod_fastcgi不会对其进行任何进程管理的服务器-它只会伸向您告诉它使用的unix或TCP套接字,并将请求/响应转发给它.您或httpd之外的某些守护程序必须正在启动某些操作以侦听列出的套接字.最基本的方法是"fcgistarter"实用程序,其他选项是诸如php-fpm之类的东西.

FastCgiExternalServer is a server that mod_fastcgi will NOT do any process management for -- it will just reach out to the unix or TCP socket you tell it to use and forward requests/responses to it. You, or some daemon outside of httpd, must be starting something to listen on the listed socket. The most basic way is the 'fcgistarter' utility, other options are things like php-fpm.

这篇关于Apache FastCGI PHP中的FastCgiExternalServer和FastCgiServer之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆