httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Iliffe <john.ili...@iliffe.ca>
Subject Re: [users@httpd] Getting PHP-FPM working
Date Sat, 20 May 2017 17:15:36 GMT
Hi Christian:

I have been trying several things on this piece of frustration, with very 
little result, but I do have some additional information as to what is 
actually happening (I think).

I would like your (or anyone else's) opinion as to whether I have found a 
bug in php-fpm as implemented under PHP-7.1.3.  I notice that many of the 
replies I have received suggest that they are related to PHP-5.x.x.

Here is the strace capture followed by the questions that occurred to me:

In the attached trace, in the final few hundred lines, (at line 24550 and 
following):

----------------------------
9223  12:25:52 lstat("/httpd/iliffe//i_phpinfo.php", {st_mode=S_IFREG|0644, 
st_size=213, ...}) = 0
9223  12:25:52 lstat("/httpd/iliffe", {st_mode=S_IFDIR|0755, st_size=4096, 
...}) = 0
9223  12:25:52 lstat("/httpd", {st_mode=S_IFDIR|0755, st_size=141, ...}) = 
0
9223  12:25:52 lstat("/httpd/iliffe/.user.ini", 0x7ffe0e20ae80) = -1 ENOENT 
(No such file or directory)

and then starting at line 24584:

9223  12:25:52 lstat("/httpd/i_phpinfo.php", 0x7ffe0e208f30) = -1 ENOENT (No 
such file or directory)
9223  12:25:52 write(2, "ERROR: Unable to open primary sc"..., 95) = 95
9223  12:25:52 times( <unfinished ...>
9222  12:25:52 <... epoll_wait resumed> [{EPOLLIN, {u32=27169440, 
u64=27169440}}], 11, 1000) = 1
9223  12:25:52 <... times resumed> {tms_utime=0, tms_stime=0, tms_cutime=0, 
tms_cstime=0}) = 486185773
9223  12:25:52 setitimer(ITIMER_PROF, {it_interval={tv_sec=0, tv_usec=0}, 
it_value={tv_sec=0, tv_usec=0}},  <unfinished ...>
9222  12:25:52 read(10,  <unfinished ...>
9223  12:25:52 <... setitimer resumed> NULL) = 0
9222  12:25:52 <... read resumed> "ERROR: Unable to open primary sc"..., 
1023) = 95
9223  12:25:52 write(3, "\1\7\0\1\0X\0\0Unable to open primary s"..., 240 
<unfinished ...>
9222  12:25:52 write(3, "[20-May-2017 12:25:52] WARNING: "..., 169 
<unfinished ...>
--------------------------------

1.  php-fpm was able to lstat the correct file (first line pasted above) and 
lstat shows it as a world-readable regular file (S_IFREG|0644).  Why not 
just open the script file and read it?  Why keep descending the directory 
tree?  That said, the responses from lstat suggest that these sub- 
directories exist and are descendable.  (755). 

2.  So far, no error log entries (or anything else have been written, so I 
assume that at this point php-fpm could have read the script file, but 
starting at line 24584, php-fpm attempts to stat the WRONG file and gets 
ENOENT.  This is understandable because the path is now wrong (subdirectory 
is missing).   

3.  The error in 2 leads to all of the error log entries, obviously file 
handle 2 is assigned to php-fpm.log and file handle 3 to httpd.error.log (or 
vice versa).  The actual browser display probably is Apache's 
interpretation of the error received.

There is a lot of other activity but that is probably just the multi-
threading working.

So, does this suggest anything to anyone?  And, if so, am I on the wrong 
list here?

John
==========================================
On Thursday 18 May 2017 04:36:19 Christian Hettler wrote:
> Hello John,
> 
> http://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html
> 
> If you want to serve http://your.virtual.srv/info to fpm-php
> you have to configure
> 
> ProxyPassMatch ^/info$ fcgi://127.0.0.1:9015/httpd/iliffe/
> 
> and put the file "info" into the directory "/httpd/iliffe/".
> 
> Another example:
> To serve
>         http://your.virtual.srv/myapp/info.php
> configure
>         ProxyPassMatch "^/myapp/.*\.php(/.*)?$"
> fcgi://127.0.0.1:9015/httpd/iliffe/ and put info.php into
>         /httpd/iliffe/myapp/
> 
> One more example:
> 
> If you have
>         /httpd/iliffe/i_phpinfo.php
> an the config is
>         ProxyPassMatch "^/.*\.php(/.*)?$"
> fcgi://127.0.0.1:9015/httpd/iliffe/ you can request
>         http://your.virtual.srv/i_phpinfo.php
> 
> The match of the url must be equal to the filesystem beyond
> DocumentRoot. DocumentRoot must be specified in "fcgi://127.0.0.1:..."
> 
> If you want to serve http://your.virtual.srv/info from
> /httpd/iliffe/i_phpinfo.php you have to rewrite "info" first (not
> tested):
> 
>         RewriteRule ^/info$ /i_phpinfo.php [P]
>         ProxyPassMatch "^/.*\.php(/.*)?$"
> fcgi://127.0.0.1:9015/httpd/iliffe/
> 
> Hope this helps.
> 
> regards,
> 
> Christian
> 

Mime
View raw message