On Thu, Nov 3, 2016 at 3:06 PM, Jason Brooks <[email protected]> wrote:
> Hello, > > So, the need to make sense of this is not an issue: I will be using the > mod_proxy_fcgi to use php-fpm. I am just curious. > > While trying various configurations to get php-fpm to work, I found the > following conundrum: the following configuration should NOT work but it > does... > > Here is the apache configuration snippet derived from this site > <https://www.howtoforge.com/tutorial/apache-with-php-fpm-on-ubuntu-16-04/> > dated > last August. > <Directory /usr/lib/cgi-bin> > Require all granted > </Directory> > <IfModule mod_fastcgi.c> > AddHandler php7-fcgi .php > Action php7-fcgi /php7-fcgi virtual > Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi > > > FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -socket > /var/run/php/php7.0-fpm.sock -pass-header Authorization > </IfModule> > > Here is the php-fpm www pool socket definition as configured > out-of-the-box: > listen = /run/php/php7.0-fpm.sock > > My test php script calls phpinfo() only. It works. It’s not clear how it > works. > Apache opens /var/run/php/php7.0-fpm.sock > php-fpm opens /run/php/php7.0-fpm.sock > removal of either file causes php not to work. > When I point apache to the socket file php-fpm opens, it does not work. > > HOW? How does apache manage to connect to php-fpm when the defined socket > paths do not make sense? As far as I know, the unix socket file is simply > opened and read/written to: there’s no way to tell linux “connect both > files to each other” from within a program... > Action+AddHandler tells Apache to send requests for *.php as a parameter to another URL, /php7-fcgi The Alias maps that to an imaginary place in the filesystem, because: mod_fastcgi compares the mapped path to its list of FastCgiExternalServers and sends the request to the app on the other end of the socket -- Eric Covener [email protected]
