Web lists-archives.com

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




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.
> 
Please ignore this following paragraph.  It was an attempt at a minimalist 
ProxyPassMatch that would bypass any regex errors.  It isn't useful in the 
real world so I dropped trying it.  I think you got that info from the 
Apache mailing list.
> 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 ...
> 
Some further info: 

Yes, /httpd is the root directory for the web pages.  The production server 
has a lot of named virtual hosts on it and each one has a document root of 
/httpd/<server name>/  and the test server is set up the same way.  The 
test server is www.iliffe.ca and its document root thus becomes /httpd/iliffe 
plus a few subs below that where needed.  In this case, there are no 
additional subs.

When I tried the $1 extension as you suggested it didn't work, see previous 
memo; so I removed the $1 and also the last '/' in the ProxyPassMatch 
directive and now php-fpm has the correct path and file but without the 
double '//'.  So, this is one case where a trailing / on a directory does 
not work/isn't required.  Here is the strace record:

-------------------------------
5254  20:14:55 lstat("/httpd/iliffe/i_phpinfo.php", {st_mode=S_IFREG|0644, 
st_size=213, ...}) = 0
--------------------------------

php-fpm received a 0 from lstat (file exists), is a regular file (S_IFREG) 
and is readable (0644).  So that makes no difference to the result.  php-fpm 
still backs down the directory tree and then tries to stat the wrong file 
name.  Just for completeness, here is the php-fpm log entry:

----------------------------------
[23-May-2017 20:14:55] WARNING: [pool www] child 5254 said into stderr: 
"ERROR: Unable to open primary script: /httpd/iliffe/i_phpinfo.php (No such 
file or directory)"
---------------------------------

I haven't been able to find out yet if the parameter data is picked up when 
the Apache directive is coded this way.   (eg:   i_phpinfo.php?a=b&c=d)  

I seem to be getting a good argument here for backing off to PHP5!

Regards,

John
===============================

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php