Re: [PHP] PHP-FPM fails to start scripts

[email protected] (John Iliffe)
Newsgroups php.general
Message-ID <[email protected]>
On Tuesday 23 May 2017 02:40:03 Lester Caine wrote:
> On 23/05/17 02:41, John Iliffe wrote:
> > The Apache directive invoking this script is:
> > 	ProxyPassMatch "^/.*\.php(/.*)?$" fcgi://127.0.0.1:9015/httpd/iliffe/
> 
> ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9015/httpd/iliffe/$1
> was your original line, and this should have resulted in the right
> trimming of slashes while I think you are currently getting the double
> slash because of the trailing one in your current string.
> 
> ProxyPassMatch ^/info$ fcgi://127.0.0.1:9015/httpd/iliffe/i_phpinfo.php
> and http://localhost/info should work ... but is /httpd REALLY a root
> folder? I'm getting /srv/www/htdocs as the default root, and I switch to
> /srv/website/test.com for each website ...
> 
> I'm still running Apache2.4 with mod_php5.so as I was having a similar
> problem 'converting'. I've got nginx running php-fpm and even different
> versions which I can pick up, but I could do with having another go with
> the old Apache machines if only to allow PHP7 to run with the PHP5 setup
> ;)
Thanks Lester.

Now that was interesting.  My original line didn't have the $1 on the end 
of the match, so I added it.  Now I get "File Not Found" as a browser 
response and the trace doesn't show all those lstats.  Only one now and it 
is a stat (not lstat).

3156  12:41:52 stat("/httpd/iliffe", {st_mode=S_IFDIR|0755, st_size=4096, 
...}) = 0

Note that the requested script is no longer there.  It still gets the 
correct path from somewhere.  The log entries are:

-----------------------
php-fpm.log
[23-May-2017 12:42:16] ERROR: unable to read what child say: Bad file 
descriptor (9)
[23-May-2017 12:42:16] ERROR: unable to read what child say: Bad file 
descriptor (9)
-----------------------

httpd log
[Tue May 23 12:43:15.441179 2017] [proxy:error] [pid 2980:tid 
140444876887808] (111)Connection refused: AH00957: FCGI: attempt to connect 
to 127.0.0.1:9015 (*) failed
[Tue May 23 12:43:15.441237 2017] [proxy_fcgi:error] [pid 2980:tid 
140444876887808] [client 206.248.138.118:43231] AH01079: failed to make 
connection to backend: 127.0.0.1
[Tue May 23 12:43:18.797290 2017] [proxy_fcgi:error] [pid 2981:tid 
140444935636736] [client 206.248.138.118:43232] AH01071: Got error 'Primary 
script unknown\n'
---------------------------------

ss -a shows socket 127.0.0.1:9015 is active:
tcp    LISTEN     0      128    127.0.0.1:9015                  *:*                    
tcp    LISTEN     0      0      127.0.0.1:9015                  *:* 

Any other ideas?  

FYI, buried in the php-fpm source code there are a number of comments about 
the problem of getting the correct directory path from Apache calls.  Looks 
like the PHP folks haven't solved the problem for PHP 7 yet.  While I was 
Googling this problem I noticed piles of reports of problems with nginx 
running php-fpm so maybe they resolved that first.  One other point is the 
big section in the man pages for lstat for Fedora 25 showing changes in the 
macros.  I'm not a good enough programmer to understand a lot of it.

John (VA3JI/VE3CES)
=================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.