Difference between FastCgiExternalServer and FastCgiServer in Apache FastCGI PHP?

Just let me say I'm new to FastCGI. I have MAMP Apache on my OS X machine. The default PHP handler was Apache Handler 2.0 (libphp5.so). I wanted to switch to FastCGI and followed the answer here: How to configure Apache to run PHP as FastCGI on Ubuntu 12.04 through the terminal?

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> 

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

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

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

But /Applications/MAMP/fcgi-bin/php5.fcgi exists and its contents:

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

What is the difference between FastCgiServer and FastCgiExternalServer and why did FastCgiExternalServer not work in my case, but FastCgiServer worked?

+8
php apache fastcgi mod-fastcgi
source share
2 answers

FastCgiServer is a server on which mod_fastcgi will process for - twisting instances up and down and providing them with a unix domain socket for listening. No external steps are required to start the fastcgi server.

FastCgiExternalServer is a server to which mod_fastcgi will NOT perform any process control - it simply extends to a unix or TCP socket, which you tell it to use and forward requests / responses to it. You, or some kind of daemon outside of httpd, should start listening on something on the specified socket. The easiest way is the "fcgistarter" utility, other parameters are like php-fpm.

+8
source share

If performance is the reason, I would say using Apache with fcgid. This is considered best for performance. To handle performance, mod_fcgid runs several instances of CGI programs to handle concurrent requests. This alternates with mod_php for PHP developers, which gives better performance. This article I found is a great resource to learn.

http://2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html

+1
source share

All Articles