Getting PHP-FPM working

classic Classic list List threaded Threaded
31 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Getting PHP-FPM working

John Iliffe

I'm not sure is this is the correct list to post these questions to, since I now have things isolated to a single module in PHP-FPM, so please redirect me if necessary. This is a continuation of the problems I was having (on this list) installing a new server last month.

---------------------

Summary: PHP-FPM will not execute any scripts; it is set up according to the PHP-FPM Wiki documentation so far as I can see.

---------------------

O/S Fedora 25, Apache 2.4.25 compiled from source, PHP 7.1.3 compiled from source.

I did a clean install of PHP-7.1.3 for testing, PHP-FPM is running under its own user/group phpfpm. Set up as listen on 127.0.0.1:9015 in pool www. Document root in www.conf is /httpd/iliffe which has been set to world readable, SELinux is set to permissive so it isn't in the equation. Log level on PHP is debug. All available log info is at the end of this memo.

It seems obvious to me that the proxy_fcgi module is worked as expected and that the problem is somewhere in PHP-FPM.

mod_php was tried as a check on the installation and works OK when enabled.

I am using the minimalist proxy configuration in Apache, (the target PHP script is hard coded to avoid regex errors) and the target PHP script file is being reported correctly by both Apache and PHP-FPM. I checked by su as the phpfpm user and I can read this file, no problems at all.

The problem has been traced to fpm_main.c, specifically the following:

-----------------------------

if (UNEXPECTED(php_fopen_primary_script(&file_handle) == FAILURE)) {

		zend_try {
			zlog(ZLOG_ERROR, "Unable to open primary script: %s (%s)", primary_script, strerror(errno));
			if (errno == EACCES) {
				SG(sapi_headers).http_response_code = 403;
				PUTS("Access denied.\n");
			} else {
				SG(sapi_headers).http_response_code = 404;
				PUTS("No input file specified.\n");

--------------------------------

Changing the script path in httpd.conf leads to a browser File Not Found error as would be expected. The document root in httpd.conf and in www.conf (PHP pool conf file for this pool) are the same.

In Apache, the minimum is set in httpd.conf:

# Default host (www.iliffe.ca)

# This one picks up all IP based hacker garbage too

<VirtualHost *:80>

ServerName www.iliffe.ca

DocumentRoot /httpd/iliffe

Options FollowSymLinks

H2Direct on

# ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9015/httpd/iliffe/$1

ProxyPassMatch ^/info$ fcgi://127.0.0.1:9015/httpd/iliffe/i_phpinfo.php

As far as I can see, all necessary Apache modules are loaded:

# /usr/apache-2.4.25/bin/httpd -M

Loaded Modules:

core_module (static)

so_module (static)

http_module (static)

**** big list of modules skipped here****

proxy_module (shared)

proxy_connect_module (shared)

proxy_http_module (shared)

proxy_fcgi_module (shared)

ssl_module (shared)

unixd_module (shared)

http2_module (shared)

status_module (shared)

******more modules skipped here****

I'm completely stuck here and any ideas or assistance would be appreciated.

Regards,

John

All following errors from one screen access:

-------------------------

PHP-FPM log:

[13-May-2017 14:40:33.423449] DEBUG: pid 16444, fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www] currently 0 active children, 2 spare children, 2 running children. Spawning rate 1

[13-May-2017 14:40:34.265891] WARNING: pid 16444, fpm_stdio_child_said(), line 197: [pool www] child 16445 said into stderr: "ERROR: main(), line 1947: Unable to open primary script: /httpd/iliffe/i_phpinfo.php (No such file or directory)"

[13-May-2017 14:40:34.265952] DEBUG: pid 16444, fpm_event_loop(), line 419: event module triggered 1 events

[13-May-2017 14:40:34.424195] DEBUG: pid 16444, fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www] currently 0 active children, 2 spare children, 2 running children. Spawning rate 1

----------------------------

Apache Access Log:

206.248.138.118 - - [13/May/2017:14:40:34 -0400] "GET /info HTTP/1.1" 404 25 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"

------------------------------

Apache Error Log:

[Sat May 13 14:40:34.266066 2017] [proxy_fcgi:error] [pid 16122:tid 140525759854336] [client 206.248.138.118:57270] AH01071: Got error 'Unable to open primary script: /httpd/iliffe/i_phpinfo.php (No such file or directory)\n'

-------------------------------

Browser Screen Error:

No input file specified.

--------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

Eric Covener
On Sat, May 13, 2017 at 3:43 PM, John Iliffe <[hidden email]> wrote:
> O/S Fedora 25, Apache 2.4.25 compiled from source, PHP 7.1.3 compiled from
> source.

There was a regression in this release. Can you try a patch or the
previous release to confirm?

--
Eric Covener
[hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

Eric Covener
http://home.apache.org/~jim/patches/mod_proxy_fcgi-v3.patch

On Sat, May 13, 2017 at 3:42 PM, Eric Covener <[hidden email]> wrote:

> On Sat, May 13, 2017 at 3:43 PM, John Iliffe <[hidden email]> wrote:
>> O/S Fedora 25, Apache 2.4.25 compiled from source, PHP 7.1.3 compiled from
>> source.
>
> There was a regression in this release. Can you try a patch or the
> previous release to confirm?
>
> --
> Eric Covener
> [hidden email]



--
Eric Covener
[hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
Wow!  That was sure fast,  Thanks Eric.

I'm not quite sure how to handle a diff file like this so it will take a
while to try it out.  Using the standard Linux/gcc utilities, is there any
way to fix things up automatically?  (sorry, I'm not a programmer).

John
=======================================
On Saturday 13 May 2017 15:44:09 Eric Covener wrote:
> http://home.apache.org/~jim/patches/mod_proxy_fcgi-v3.patch
>
> On Sat, May 13, 2017 at 3:42 PM, Eric Covener <[hidden email]> wrote:
> > On Sat, May 13, 2017 at 3:43 PM, John Iliffe <[hidden email]>
wrote:
> >> O/S Fedora 25, Apache 2.4.25 compiled from source, PHP 7.1.3 compiled
> >> from source.
> >
> > There was a regression in this release. Can you try a patch or the
> > previous release to confirm?
> >
> > --
> > Eric Covener
> > [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

Eric Covener
On Sat, May 13, 2017 at 4:00 PM, John Iliffe <[hidden email]> wrote:
> Wow!  That was sure fast,  Thanks Eric.
>
> I'm not quite sure how to handle a diff file like this so it will take a
> while to try it out.  Using the standard Linux/gcc utilities, is there any
> way to fix things up automatically?  (sorry, I'm not a programmer).

/usr/bin/patch will probably work on the code portions.  You pass the
diff on stdin.
You might get some rejects in e.g. the CHANGES and STATUS file that
can just be ignored.

In this particular case, you might just try extracting
http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_fcgi.c?revision=1788445&view=co
on top of your current mod_proxy_fcgi.c

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
Thanks Eric.

I downloaded the mod_proxy_fcgi.c link.

I have to leave here for a while but I will get back on this either tonight
or tomorrow and I'll let you know how it works.

John
==================================
On Saturday 13 May 2017 16:00:47 Eric Covener wrote:

> On Sat, May 13, 2017 at 4:00 PM, John Iliffe <[hidden email]> wrote:
> > Wow!  That was sure fast,  Thanks Eric.
> >
> > I'm not quite sure how to handle a diff file like this so it will take
> > a while to try it out.  Using the standard Linux/gcc utilities, is
> > there any way to fix things up automatically?  (sorry, I'm not a
> > programmer).
>
> /usr/bin/patch will probably work on the code portions.  You pass the
> diff on stdin.
> You might get some rejects in e.g. the CHANGES and STATUS file that
> can just be ignored.
>
> In this particular case, you might just try extracting
> http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mo
> d_proxy_fcgi.c?revision=1788445&view=co on top of your current
> mod_proxy_fcgi.c
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
In reply to this post by Eric Covener
Hi Eric:

I downloaded the revised mod_proxy_fcgi.c from your link, retrieved the
backup of the original download of Apache-2.4.25, replaced the
modules/mod_proxy_fcgi.c, and recompiled using the config.nice file from last
time.  Then I moved the new mod_proxy_fcgi.so into the existing Apache
modules directory.

Unfortunately, still have the same problem.

Any other ideas come to mind?

John
======================================
On Saturday 13 May 2017 16:00:47 Eric Covener wrote:

> On Sat, May 13, 2017 at 4:00 PM, John Iliffe <[hidden email]> wrote:
> > Wow!  That was sure fast,  Thanks Eric.
> >
> > I'm not quite sure how to handle a diff file like this so it will take
> > a while to try it out.  Using the standard Linux/gcc utilities, is
> > there any way to fix things up automatically?  (sorry, I'm not a
> > programmer).
>
> /usr/bin/patch will probably work on the code portions.  You pass the
> diff on stdin.
> You might get some rejects in e.g. the CHANGES and STATUS file that
> can just be ignored.
>
> In this particular case, you might just try extracting
> http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mo
> d_proxy_fcgi.c?revision=1788445&view=co on top of your current
> mod_proxy_fcgi.c
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

Eric Covener
On Sat, May 13, 2017 at 7:56 PM, John Iliffe <[hidden email]> wrote:

> Hi Eric:
>
> I downloaded the revised mod_proxy_fcgi.c from your link, retrieved the
> backup of the original download of Apache-2.4.25, replaced the
> modules/mod_proxy_fcgi.c, and recompiled using the config.nice file from last
> time.  Then I moved the new mod_proxy_fcgi.so into the existing Apache
> modules directory.
>
> Unfortunately, still have the same problem.
>
> Any other ideas come to mind?

Can you paste the output of  :
  namei -m /httpd/iliffe/i_phpinfo.php

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
Sure:

----------------------
# namei -m /httpd/iliffe/i_phpinfo.php
f: /httpd/iliffe/i_phpinfo.php
 dr-xr-xr-x /
 drwxr-xr-x httpd
 drwxr-xr-x iliffe
 -rw-r--r-- i_phpinfo.php
----------------------

John
=========================================
On Saturday 13 May 2017 19:54:44 Eric Covener wrote:

> On Sat, May 13, 2017 at 7:56 PM, John Iliffe <[hidden email]> wrote:
> > Hi Eric:
> >
> > I downloaded the revised mod_proxy_fcgi.c from your link, retrieved
> > the backup of the original download of Apache-2.4.25, replaced the
> > modules/mod_proxy_fcgi.c, and recompiled using the config.nice file
> > from last time.  Then I moved the new mod_proxy_fcgi.so into the
> > existing Apache modules directory.
> >
> > Unfortunately, still have the same problem.
> >
> > Any other ideas come to mind?
>
> Can you paste the output of  :
>   namei -m /httpd/iliffe/i_phpinfo.php
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

Eric Covener
On Sat, May 13, 2017 at 11:01 PM, John Iliffe <[hidden email]> wrote:

> Sure:
>
> ----------------------
> # namei -m /httpd/iliffe/i_phpinfo.php
> f: /httpd/iliffe/i_phpinfo.php
>  dr-xr-xr-x /
>  drwxr-xr-x httpd
>  drwxr-xr-x iliffe
>  -rw-r--r-- i_phpinfo.php
> ----------------------

There's something odd  about that code/logging (no parameter on the
open call repesenting the name!) Can you strace the FPM process and
see what it actually tries to open?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

Daniel
The fpm pool, which chdir/chroot values they have? if they do, set chroot to "/" and comment chdir and try again, just in case.

2017-05-14 17:42 GMT+02:00 Eric Covener <[hidden email]>:
On Sat, May 13, 2017 at 11:01 PM, John Iliffe <[hidden email]> wrote:
> Sure:
>
> ----------------------
> # namei -m /httpd/iliffe/i_phpinfo.php
> f: /httpd/iliffe/i_phpinfo.php
>  dr-xr-xr-x /
>  drwxr-xr-x httpd
>  drwxr-xr-x iliffe
>  -rw-r--r-- i_phpinfo.php
> ----------------------

There's something odd  about that code/logging (no parameter on the
open call repesenting the name!) Can you strace the FPM process and
see what it actually tries to open?

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]




--
Daniel Ferradal
IT Specialist

email         dferradal at gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
In reply to this post by Eric Covener
Hi Eric:

Sorry for the delay, I'm not ignoring you;  Fedora 25 comes without strace.

autrace seems to be the replacement but I have been unable to get it to run
properly so far.  What happens is the start up thread runs and then
immediately terminates without letting me run an http request.  So, lots of
data but no information.

Here's how (one of the ways, anyway) I have been calling autrace, just in
case you are familiar with it:

autrace /usr/php-7.1.3/sbin/php-fpm php-fpm "-c /usr/php-7.1.3/lib/php.ini
-y /usr/php-7.1.3/etc/php-fpm.conf --daemonize --pid /var/run"

If I can figure out how to do it, I'll add some print statements around the
place where the error is being printed in php-fpm, and recompile, and see
what the various variables are at that point.  I know where this is in php-
fpm but I don't yet know the variable names.  I have some stuff that I have
to do tomorrow so may be Tuesday before I can get a definitive answer.

Also, it occurred to me that maybe I could trap what mod_proxy_fcgi is
actually passing to php-fpm and then feed variations of that into php-fpm
until I get a useful result.  Do you think that might be useful?

Sorry, and thanks for your prompt responses.

John
======================================
On Sunday 14 May 2017 11:42:53 Eric Covener wrote:

> On Sat, May 13, 2017 at 11:01 PM, John Iliffe <[hidden email]> wrote:
> > Sure:
> >
> > ----------------------
> > # namei -m /httpd/iliffe/i_phpinfo.php
> > f: /httpd/iliffe/i_phpinfo.php
> >
> >  dr-xr-xr-x /
> >  drwxr-xr-x httpd
> >  drwxr-xr-x iliffe
> >  -rw-r--r-- i_phpinfo.php
> >
> > ----------------------
>
> There's something odd  about that code/logging (no parameter on the
> open call repesenting the name!) Can you strace the FPM process and
> see what it actually tries to open?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
In reply to this post by Daniel
Browser:  No Input File Specified

---------------------------------------
Apache access Log
        206.248.138.118 - - [14/May/2017:23:58:23 -0400] "GET /info HTTP/1.1"
404 25 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Firefox/45.0"

---------------------------------------
Apache error log
        [Sun May 14 23:58:23.049153 2017] [proxy_fcgi:error] [pid 867:tid
140553157863168] [client 206.248.138.118:57741] AH01071: Got error 'Unable
to open primary script: /httpd/iliffe/i_phpinfo.php (No such file or
directory)\n'

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

----------------------------------------
php www pool conf file

        ; Chroot to this directory at the start. This value must be defined as
an
; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead.
; Note: chrooting is a great security feature and should be used whenever
;       possible. However, all PHP paths will be relative to the chroot
;       (error_log, sessions.save_path, ...).
; Default Value: not set
chroot = /

; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
;chdir = /var/www
;chdir = /httpd/iliffe


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

On Sunday 14 May 2017 17:55:41 Daniel wrote:

> The fpm pool, which chdir/chroot values they have? if they do, set
> chroot to "/" and comment chdir and try again, just in case.
>
> 2017-05-14 17:42 GMT+02:00 Eric Covener <[hidden email]>:
> > On Sat, May 13, 2017 at 11:01 PM, John Iliffe <[hidden email]>
> >
> > wrote:
> > > Sure:
> > >
> > > ----------------------
> > > # namei -m /httpd/iliffe/i_phpinfo.php
> > > f: /httpd/iliffe/i_phpinfo.php
> > >
> > >  dr-xr-xr-x /
> > >  drwxr-xr-x httpd
> > >  drwxr-xr-x iliffe
> > >  -rw-r--r-- i_phpinfo.php
> > >
> > > ----------------------
> >
> > There's something odd  about that code/logging (no parameter on the
> > open call repesenting the name!) Can you strace the FPM process and
> > see what it actually tries to open?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
In reply to this post by Eric Covener
Hi Eric:

This may or may not be relevant, but I also have the Surgemail mail client
running by proxying a port 80 address to the Surgemail socket.  

The point is, when I started it on Apache-2.4.25 the internal links stopped
working.  I had to explicitly give the entire path and everything worked
again.  This isn't a mod_proxy_fcgi situation, it just uses the standard
mod_proxy stuff, but since mod_proxy is a required base, maybe something
doesn't get passed correctly (?).

Seems odd to me but I thought I had better mention it just in case.

John
===================================
On Sunday 14 May 2017 11:42:53 Eric Covener wrote:

> On Sat, May 13, 2017 at 11:01 PM, John Iliffe <[hidden email]> wrote:
> > Sure:
> >
> > ----------------------
> > # namei -m /httpd/iliffe/i_phpinfo.php
> > f: /httpd/iliffe/i_phpinfo.php
> >
> >  dr-xr-xr-x /
> >  drwxr-xr-x httpd
> >  drwxr-xr-x iliffe
> >  -rw-r--r-- i_phpinfo.php
> >
> > ----------------------
>
> There's something odd  about that code/logging (no parameter on the
> open call repesenting the name!) Can you strace the FPM process and
> see what it actually tries to open?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

Christian Hettler
In reply to this post by John Iliffe
Hello John,

the manual (mod_proxy_fcgi.html) states:

"The request URL is implicitly added to the 2nd parameter."

(Did|Can) you try

ProxyPassMatch "^/.*\.php(/.*)?$" "fcgi://127.0.0.1:9015/httpd/iliffe/"

instead of

> #   ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9015/httpd/iliffe/$1


regards,

Christian

On Sat, May 13, 2017 at 03:43:08PM -0400, John Iliffe wrote:

> I'm not sure is this is the correct list to post these questions to, since
> I now have things isolated to a single module in PHP-FPM, so please
> redirect me if necessary.  This is a continuation of the problems I was
> having (on this list) installing a new server last month.
>
> ---------------------
> Summary: PHP-FPM will not execute any scripts; it is set up according to
> the PHP-FPM Wiki documentation so far as I can see.
> ---------------------
>
> O/S  Fedora 25, Apache 2.4.25 compiled from source, PHP 7.1.3 compiled from
> source.
>
> I did a clean install of PHP-7.1.3 for testing, PHP-FPM is running under
> its own user/group phpfpm.  Set up as listen  on 127.0.0.1:9015 in pool
> www.  Document root in www.conf is /httpd/iliffe which has been set to world
> readable, SELinux is set to permissive so it isn't in the equation.  Log
> level on PHP is debug.  All available log info is at the end of this memo.
>
> It seems obvious to me that the proxy_fcgi module is worked as expected and
> that the problem is somewhere in PHP-FPM.
>
> mod_php was tried as a check on the installation and works OK when enabled.
>
> I am using the minimalist proxy configuration in Apache, (the target PHP
> script is hard coded to avoid regex errors) and the target PHP script file
> is being reported correctly by both Apache and PHP-FPM.  I checked by su as
> the phpfpm user and I can read this file, no problems at all.
>
> The problem has been traced to fpm_main.c, specifically the following:
>
> -----------------------------
> if (UNEXPECTED(php_fopen_primary_script(&file_handle) == FAILURE)) {
> zend_try {
> zlog(ZLOG_ERROR, "Unable to open primary script: %s (%s)", primary_script, strerror(errno));
> if (errno == EACCES) {
> SG(sapi_headers).http_response_code = 403;
> PUTS("Access denied.\n");
> } else {
> SG(sapi_headers).http_response_code = 404;
> PUTS("No input file specified.\n");
> --------------------------------
>
> Changing the script path in httpd.conf leads to a browser File Not Found
> error as would be expected.  The document root in httpd.conf and in
> www.conf (PHP pool conf file for this pool) are the same.
>
> In Apache, the minimum is set in httpd.conf:  
>
> # Default host (www.iliffe.ca)
> # This one picks up all IP based hacker garbage too
> <VirtualHost *:80>
>    ServerName www.iliffe.ca
>    DocumentRoot /httpd/iliffe
>    Options FollowSymLinks
>    H2Direct on
>
> #   ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9015/httpd/iliffe/$1
>   ProxyPassMatch ^/info$ fcgi://127.0.0.1:9015/httpd/iliffe/i_phpinfo.php
>
> As far as I can see, all necessary Apache modules are loaded:
>
> # /usr/apache-2.4.25/bin/httpd -M
> Loaded Modules:
>  core_module (static)
>  so_module (static)
>  http_module (static)
>
> **** big list of modules skipped here****
>  proxy_module (shared)
>  proxy_connect_module (shared)
>  proxy_http_module (shared)
>  proxy_fcgi_module (shared)
>  ssl_module (shared)
>  unixd_module (shared)
>  http2_module (shared)
>  status_module (shared)
>
> ******more modules skipped here****
>
> I'm completely stuck here and any ideas or assistance would be appreciated.
>
> Regards,
>
> John
>
> All following errors from one screen access:
> -------------------------
> PHP-FPM log:
> [13-May-2017 14:40:33.423449] DEBUG: pid 16444,
> fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www] currently
> 0 active children, 2 spare children, 2 running children. Spawning rate 1
> [13-May-2017 14:40:34.265891] WARNING: pid 16444, fpm_stdio_child_said(),
> line 197: [pool www] child 16445 said into stderr: "ERROR: main(), line
> 1947: Unable to open primary script: /httpd/iliffe/i_phpinfo.php (No such
> file or directory)"
> [13-May-2017 14:40:34.265952] DEBUG: pid 16444, fpm_event_loop(), line 419:
> event module triggered 1 events
> [13-May-2017 14:40:34.424195] DEBUG: pid 16444,
> fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www] currently
> 0 active children, 2 spare children, 2 running children. Spawning rate 1
> ----------------------------
>
> Apache Access Log:
> 206.248.138.118 - - [13/May/2017:14:40:34 -0400] "GET /info HTTP/1.1" 404
> 25 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
> Firefox/45.0"
> ------------------------------
>
> Apache Error Log:
> [Sat May 13 14:40:34.266066 2017] [proxy_fcgi:error] [pid 16122:tid
> 140525759854336] [client 206.248.138.118:57270] AH01071: Got error 'Unable
> to open primary script: /httpd/iliffe/i_phpinfo.php (No such file or
> directory)\n'
> -------------------------------
>
> Browser Screen Error:
>    No input file specified.
> --------------------------------
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
Thank you for your suggestion Christian.

Same result.  (there are no passed parameters to the script being invoked).

httpd.conf:
          ProxyPassMatch ^/.*\.php(/.*)?$ fcgi://127.0.0.1:9015/httpd/iliffe/

Browser:
        No input file specified.

Apache error log:
        [Mon May 15 10:12:26.832070 2017] [proxy_fcgi:error] [pid 10030:tid
139886816392960] [client 206.248.138.118:50926] AH01071: Got error 'Unable
to open primary script: /httpd/iliffe//i_phpinfo.php (No such file or
directory)\n'

php-fpm error log:
        [15-May-2017 10:12:26] WARNING: [pool www] child 7551 said into
stderr: "ERROR: Unable to open primary script: /httpd/iliffe//i_phpinfo.php
(No such file or directory)"

Regards,

John
===================================
On Monday 15 May 2017 05:21:59 Christian Hettler wrote:

> Hello John,
>
> the manual (mod_proxy_fcgi.html) states:
>
> "The request URL is implicitly added to the 2nd parameter."
>
> (Did|Can) you try
>
> ProxyPassMatch "^/.*\.php(/.*)?$" "fcgi://127.0.0.1:9015/httpd/iliffe/"
>
> instead of
>
> > #   ProxyPassMatch ^/(.*\.php(/.*)?)$
> > fcgi://127.0.0.1:9015/httpd/iliffe/$1
>
> regards,
>
> Christian
>
> On Sat, May 13, 2017 at 03:43:08PM -0400, John Iliffe wrote:
> > I'm not sure is this is the correct list to post these questions to,
> > since I now have things isolated to a single module in PHP-FPM, so
> > please redirect me if necessary.  This is a continuation of the
> > problems I was having (on this list) installing a new server last
> > month.
> >
> > ---------------------
> > Summary: PHP-FPM will not execute any scripts; it is set up according
> > to the PHP-FPM Wiki documentation so far as I can see.
> > ---------------------
> >
> > O/S  Fedora 25, Apache 2.4.25 compiled from source, PHP 7.1.3 compiled
> > from source.
> >
> > I did a clean install of PHP-7.1.3 for testing, PHP-FPM is running
> > under its own user/group phpfpm.  Set up as listen  on 127.0.0.1:9015
> > in pool www.  Document root in www.conf is /httpd/iliffe which has
> > been set to world readable, SELinux is set to permissive so it isn't
> > in the equation.  Log level on PHP is debug.  All available log info
> > is at the end of this memo.
> >
> > It seems obvious to me that the proxy_fcgi module is worked as
> > expected and that the problem is somewhere in PHP-FPM.
> >
> > mod_php was tried as a check on the installation and works OK when
> > enabled.
> >
> > I am using the minimalist proxy configuration in Apache, (the target
> > PHP script is hard coded to avoid regex errors) and the target PHP
> > script file is being reported correctly by both Apache and PHP-FPM.
> > I checked by su as the phpfpm user and I can read this file, no
> > problems at all.
> >
> > The problem has been traced to fpm_main.c, specifically the following:
> >
> > -----------------------------
> > if (UNEXPECTED(php_fopen_primary_script(&file_handle) == FAILURE)) {
> >
> > zend_try {
> >
> > zlog(ZLOG_ERROR, "Unable to open primary script: %s (%s)",
> > primary_script, strerror(errno)); if (errno == EACCES) {
> >
> > SG(sapi_headers).http_response_code = 403;
> > PUTS("Access denied.\n");
> >
> > } else {
> >
> > SG(sapi_headers).http_response_code = 404;
> > PUTS("No input file specified.\n");
> >
> > --------------------------------
> >
> > Changing the script path in httpd.conf leads to a browser File Not
> > Found error as would be expected.  The document root in httpd.conf
> > and in www.conf (PHP pool conf file for this pool) are the same.
> >
> > In Apache, the minimum is set in httpd.conf:
> >
> > # Default host (www.iliffe.ca)
> > # This one picks up all IP based hacker garbage too
> > <VirtualHost *:80>
> >
> >    ServerName www.iliffe.ca
> >    DocumentRoot /httpd/iliffe
> >    Options FollowSymLinks
> >    H2Direct on
> >
> > #   ProxyPassMatch ^/(.*\.php(/.*)?)$
> > fcgi://127.0.0.1:9015/httpd/iliffe/$1
> >
> >   ProxyPassMatch ^/info$
> >   fcgi://127.0.0.1:9015/httpd/iliffe/i_phpinfo.php
> >
> > As far as I can see, all necessary Apache modules are loaded:
> >
> > # /usr/apache-2.4.25/bin/httpd -M
> >
> > Loaded Modules:
> >  core_module (static)
> >  so_module (static)
> >  http_module (static)
> >
> > **** big list of modules skipped here****
> >
> >  proxy_module (shared)
> >  proxy_connect_module (shared)
> >  proxy_http_module (shared)
> >  proxy_fcgi_module (shared)
> >  ssl_module (shared)
> >  unixd_module (shared)
> >  http2_module (shared)
> >  status_module (shared)
> >
> > ******more modules skipped here****
> >
> > I'm completely stuck here and any ideas or assistance would be
> > appreciated.
> >
> > Regards,
> >
> > John
> >
> > All following errors from one screen access:
> > -------------------------
> > PHP-FPM log:
> > [13-May-2017 14:40:33.423449] DEBUG: pid 16444,
> > fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www]
> > currently 0 active children, 2 spare children, 2 running children.
> > Spawning rate 1 [13-May-2017 14:40:34.265891] WARNING: pid 16444,
> > fpm_stdio_child_said(), line 197: [pool www] child 16445 said into
> > stderr: "ERROR: main(), line 1947: Unable to open primary script:
> > /httpd/iliffe/i_phpinfo.php (No such file or directory)"
> > [13-May-2017 14:40:34.265952] DEBUG: pid 16444, fpm_event_loop(), line
> > 419: event module triggered 1 events
> > [13-May-2017 14:40:34.424195] DEBUG: pid 16444,
> > fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www]
> > currently 0 active children, 2 spare children, 2 running children.
> > Spawning rate 1 ----------------------------
> >
> > Apache Access Log:
> > 206.248.138.118 - - [13/May/2017:14:40:34 -0400] "GET /info HTTP/1.1"
> > 404 25 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
> > Firefox/45.0"
> > ------------------------------
> >
> > Apache Error Log:
> > [Sat May 13 14:40:34.266066 2017] [proxy_fcgi:error] [pid 16122:tid
> > 140525759854336] [client 206.248.138.118:57270] AH01071: Got error
> > 'Unable to open primary script: /httpd/iliffe/i_phpinfo.php (No such
> > file or directory)\n'
> > -------------------------------
> >
> > Browser Screen Error:
> >    No input file specified.
> >
> > --------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
In reply to this post by Christian Hettler
Hi Christian:

I just noticed that you put "" around the parameters to ProxyPassMatch.

I tried that and no change in the results.

John
================================
On Monday 15 May 2017 05:21:59 Christian Hettler wrote:

> Hello John,
>
> the manual (mod_proxy_fcgi.html) states:
>
> "The request URL is implicitly added to the 2nd parameter."
>
> (Did|Can) you try
>
> ProxyPassMatch "^/.*\.php(/.*)?$" "fcgi://127.0.0.1:9015/httpd/iliffe/"
>
> instead of
>
> > #   ProxyPassMatch ^/(.*\.php(/.*)?)$
> > fcgi://127.0.0.1:9015/httpd/iliffe/$1
>
> regards,
>
> Christian
>
> On Sat, May 13, 2017 at 03:43:08PM -0400, John Iliffe wrote:
> > I'm not sure is this is the correct list to post these questions to,
> > since I now have things isolated to a single module in PHP-FPM, so
> > please redirect me if necessary.  This is a continuation of the
> > problems I was having (on this list) installing a new server last
> > month.
> >
> > ---------------------
> > Summary: PHP-FPM will not execute any scripts; it is set up according
> > to the PHP-FPM Wiki documentation so far as I can see.
> > ---------------------
> >
> > O/S  Fedora 25, Apache 2.4.25 compiled from source, PHP 7.1.3 compiled
> > from source.
> >
> > I did a clean install of PHP-7.1.3 for testing, PHP-FPM is running
> > under its own user/group phpfpm.  Set up as listen  on 127.0.0.1:9015
> > in pool www.  Document root in www.conf is /httpd/iliffe which has
> > been set to world readable, SELinux is set to permissive so it isn't
> > in the equation.  Log level on PHP is debug.  All available log info
> > is at the end of this memo.
> >
> > It seems obvious to me that the proxy_fcgi module is worked as
> > expected and that the problem is somewhere in PHP-FPM.
> >
> > mod_php was tried as a check on the installation and works OK when
> > enabled.
> >
> > I am using the minimalist proxy configuration in Apache, (the target
> > PHP script is hard coded to avoid regex errors) and the target PHP
> > script file is being reported correctly by both Apache and PHP-FPM.
> > I checked by su as the phpfpm user and I can read this file, no
> > problems at all.
> >
> > The problem has been traced to fpm_main.c, specifically the following:
> >
> > -----------------------------
> > if (UNEXPECTED(php_fopen_primary_script(&file_handle) == FAILURE)) {
> >
> > zend_try {
> >
> > zlog(ZLOG_ERROR, "Unable to open primary script: %s (%s)",
> > primary_script, strerror(errno)); if (errno == EACCES) {
> >
> > SG(sapi_headers).http_response_code = 403;
> > PUTS("Access denied.\n");
> >
> > } else {
> >
> > SG(sapi_headers).http_response_code = 404;
> > PUTS("No input file specified.\n");
> >
> > --------------------------------
> >
> > Changing the script path in httpd.conf leads to a browser File Not
> > Found error as would be expected.  The document root in httpd.conf
> > and in www.conf (PHP pool conf file for this pool) are the same.
> >
> > In Apache, the minimum is set in httpd.conf:
> >
> > # Default host (www.iliffe.ca)
> > # This one picks up all IP based hacker garbage too
> > <VirtualHost *:80>
> >
> >    ServerName www.iliffe.ca
> >    DocumentRoot /httpd/iliffe
> >    Options FollowSymLinks
> >    H2Direct on
> >
> > #   ProxyPassMatch ^/(.*\.php(/.*)?)$
> > fcgi://127.0.0.1:9015/httpd/iliffe/$1
> >
> >   ProxyPassMatch ^/info$
> >   fcgi://127.0.0.1:9015/httpd/iliffe/i_phpinfo.php
> >
> > As far as I can see, all necessary Apache modules are loaded:
> >
> > # /usr/apache-2.4.25/bin/httpd -M
> >
> > Loaded Modules:
> >  core_module (static)
> >  so_module (static)
> >  http_module (static)
> >
> > **** big list of modules skipped here****
> >
> >  proxy_module (shared)
> >  proxy_connect_module (shared)
> >  proxy_http_module (shared)
> >  proxy_fcgi_module (shared)
> >  ssl_module (shared)
> >  unixd_module (shared)
> >  http2_module (shared)
> >  status_module (shared)
> >
> > ******more modules skipped here****
> >
> > I'm completely stuck here and any ideas or assistance would be
> > appreciated.
> >
> > Regards,
> >
> > John
> >
> > All following errors from one screen access:
> > -------------------------
> > PHP-FPM log:
> > [13-May-2017 14:40:33.423449] DEBUG: pid 16444,
> > fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www]
> > currently 0 active children, 2 spare children, 2 running children.
> > Spawning rate 1 [13-May-2017 14:40:34.265891] WARNING: pid 16444,
> > fpm_stdio_child_said(), line 197: [pool www] child 16445 said into
> > stderr: "ERROR: main(), line 1947: Unable to open primary script:
> > /httpd/iliffe/i_phpinfo.php (No such file or directory)"
> > [13-May-2017 14:40:34.265952] DEBUG: pid 16444, fpm_event_loop(), line
> > 419: event module triggered 1 events
> > [13-May-2017 14:40:34.424195] DEBUG: pid 16444,
> > fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www]
> > currently 0 active children, 2 spare children, 2 running children.
> > Spawning rate 1 ----------------------------
> >
> > Apache Access Log:
> > 206.248.138.118 - - [13/May/2017:14:40:34 -0400] "GET /info HTTP/1.1"
> > 404 25 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
> > Firefox/45.0"
> > ------------------------------
> >
> > Apache Error Log:
> > [Sat May 13 14:40:34.266066 2017] [proxy_fcgi:error] [pid 16122:tid
> > 140525759854336] [client 206.248.138.118:57270] AH01071: Got error
> > 'Unable to open primary script: /httpd/iliffe/i_phpinfo.php (No such
> > file or directory)\n'
> > -------------------------------
> >
> > Browser Screen Error:
> >    No input file specified.
> >
> > --------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

Christian Hettler
hello John,

Is ChrootDir activated?

regards,

Christian

On Mon, May 15, 2017 at 10:42:37AM -0400, John Iliffe wrote:

> Hi Christian:
>
> I just noticed that you put "" around the parameters to ProxyPassMatch.
>
> I tried that and no change in the results.
>
> John
> ================================
> On Monday 15 May 2017 05:21:59 Christian Hettler wrote:
> > Hello John,
> >
> > the manual (mod_proxy_fcgi.html) states:
> >
> > "The request URL is implicitly added to the 2nd parameter."
> >
> > (Did|Can) you try
> >
> > ProxyPassMatch "^/.*\.php(/.*)?$" "fcgi://127.0.0.1:9015/httpd/iliffe/"
> >
> > instead of
> >
> > > #   ProxyPassMatch ^/(.*\.php(/.*)?)$
> > > fcgi://127.0.0.1:9015/httpd/iliffe/$1
> >
> > regards,
> >
> > Christian
> >
> > On Sat, May 13, 2017 at 03:43:08PM -0400, John Iliffe wrote:
> > > I'm not sure is this is the correct list to post these questions to,
> > > since I now have things isolated to a single module in PHP-FPM, so
> > > please redirect me if necessary.  This is a continuation of the
> > > problems I was having (on this list) installing a new server last
> > > month.
> > >
> > > ---------------------
> > > Summary: PHP-FPM will not execute any scripts; it is set up according
> > > to the PHP-FPM Wiki documentation so far as I can see.
> > > ---------------------
> > >
> > > O/S  Fedora 25, Apache 2.4.25 compiled from source, PHP 7.1.3 compiled
> > > from source.
> > >
> > > I did a clean install of PHP-7.1.3 for testing, PHP-FPM is running
> > > under its own user/group phpfpm.  Set up as listen  on 127.0.0.1:9015
> > > in pool www.  Document root in www.conf is /httpd/iliffe which has
> > > been set to world readable, SELinux is set to permissive so it isn't
> > > in the equation.  Log level on PHP is debug.  All available log info
> > > is at the end of this memo.
> > >
> > > It seems obvious to me that the proxy_fcgi module is worked as
> > > expected and that the problem is somewhere in PHP-FPM.
> > >
> > > mod_php was tried as a check on the installation and works OK when
> > > enabled.
> > >
> > > I am using the minimalist proxy configuration in Apache, (the target
> > > PHP script is hard coded to avoid regex errors) and the target PHP
> > > script file is being reported correctly by both Apache and PHP-FPM.
> > > I checked by su as the phpfpm user and I can read this file, no
> > > problems at all.
> > >
> > > The problem has been traced to fpm_main.c, specifically the following:
> > >
> > > -----------------------------
> > > if (UNEXPECTED(php_fopen_primary_script(&file_handle) == FAILURE)) {
> > >
> > > zend_try {
> > >
> > > zlog(ZLOG_ERROR, "Unable to open primary script: %s (%s)",
> > > primary_script, strerror(errno)); if (errno == EACCES) {
> > >
> > > SG(sapi_headers).http_response_code = 403;
> > > PUTS("Access denied.\n");
> > >
> > > } else {
> > >
> > > SG(sapi_headers).http_response_code = 404;
> > > PUTS("No input file specified.\n");
> > >
> > > --------------------------------
> > >
> > > Changing the script path in httpd.conf leads to a browser File Not
> > > Found error as would be expected.  The document root in httpd.conf
> > > and in www.conf (PHP pool conf file for this pool) are the same.
> > >
> > > In Apache, the minimum is set in httpd.conf:
> > >
> > > # Default host (www.iliffe.ca)
> > > # This one picks up all IP based hacker garbage too
> > > <VirtualHost *:80>
> > >
> > >    ServerName www.iliffe.ca
> > >    DocumentRoot /httpd/iliffe
> > >    Options FollowSymLinks
> > >    H2Direct on
> > >
> > > #   ProxyPassMatch ^/(.*\.php(/.*)?)$
> > > fcgi://127.0.0.1:9015/httpd/iliffe/$1
> > >
> > >   ProxyPassMatch ^/info$
> > >   fcgi://127.0.0.1:9015/httpd/iliffe/i_phpinfo.php
> > >
> > > As far as I can see, all necessary Apache modules are loaded:
> > >
> > > # /usr/apache-2.4.25/bin/httpd -M
> > >
> > > Loaded Modules:
> > >  core_module (static)
> > >  so_module (static)
> > >  http_module (static)
> > >
> > > **** big list of modules skipped here****
> > >
> > >  proxy_module (shared)
> > >  proxy_connect_module (shared)
> > >  proxy_http_module (shared)
> > >  proxy_fcgi_module (shared)
> > >  ssl_module (shared)
> > >  unixd_module (shared)
> > >  http2_module (shared)
> > >  status_module (shared)
> > >
> > > ******more modules skipped here****
> > >
> > > I'm completely stuck here and any ideas or assistance would be
> > > appreciated.
> > >
> > > Regards,
> > >
> > > John
> > >
> > > All following errors from one screen access:
> > > -------------------------
> > > PHP-FPM log:
> > > [13-May-2017 14:40:33.423449] DEBUG: pid 16444,
> > > fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www]
> > > currently 0 active children, 2 spare children, 2 running children.
> > > Spawning rate 1 [13-May-2017 14:40:34.265891] WARNING: pid 16444,
> > > fpm_stdio_child_said(), line 197: [pool www] child 16445 said into
> > > stderr: "ERROR: main(), line 1947: Unable to open primary script:
> > > /httpd/iliffe/i_phpinfo.php (No such file or directory)"
> > > [13-May-2017 14:40:34.265952] DEBUG: pid 16444, fpm_event_loop(), line
> > > 419: event module triggered 1 events
> > > [13-May-2017 14:40:34.424195] DEBUG: pid 16444,
> > > fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www]
> > > currently 0 active children, 2 spare children, 2 running children.
> > > Spawning rate 1 ----------------------------
> > >
> > > Apache Access Log:
> > > 206.248.138.118 - - [13/May/2017:14:40:34 -0400] "GET /info HTTP/1.1"
> > > 404 25 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
> > > Firefox/45.0"
> > > ------------------------------
> > >
> > > Apache Error Log:
> > > [Sat May 13 14:40:34.266066 2017] [proxy_fcgi:error] [pid 16122:tid
> > > 140525759854336] [client 206.248.138.118:57270] AH01071: Got error
> > > 'Unable to open primary script: /httpd/iliffe/i_phpinfo.php (No such
> > > file or directory)\n'
> > > -------------------------------
> > >
> > > Browser Screen Error:
> > >    No input file specified.
> > >
> > > --------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
In reply to this post by Eric Covener
Hi Eric:

I'm a bit slow-witted I guess, in any event, I now have strace installed
and I ran it to get the attached trace file.

It's seems to me that the problem is in the call:   (about 250 lines before
the end of the file at time stamp 11:39:16)

18767 11:39:16 lstat("/httpd/iliffe/i_phpinfo.php/info", 0x7fff1d6b4f90) = -1
ENOTDIR (Not a directory)

where the path information from the initial call is being appended to the
correct path information in the second parameter of ProxyPassMatch.  (???)

FYI, the configuration directive is:

ProxyPassMatch ^/info$ fcgi://127.0.0.1:9015/httpd/iliffe/i_phpinfo.php

so I don't understand why this would happen.

So, over to you.

Regards,

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

On Sunday 14 May 2017 11:42:53 Eric Covener wrote:

> On Sat, May 13, 2017 at 11:01 PM, John Iliffe <[hidden email]> wrote:
> > Sure:
> >
> > ----------------------
> > # namei -m /httpd/iliffe/i_phpinfo.php
> > f: /httpd/iliffe/i_phpinfo.php
> >
> >  dr-xr-xr-x /
> >  drwxr-xr-x httpd
> >  drwxr-xr-x iliffe
> >  -rw-r--r-- i_phpinfo.php
> >
> > ----------------------
>
> There's something odd  about that code/logging (no parameter on the
> open call repesenting the name!) Can you strace the FPM process and
> see what it actually tries to open?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

php-fpm.trace (1M) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Getting PHP-FPM working

John Iliffe
In reply to this post by Christian Hettler
Yes,

chroot = /

I just sent a (really big!) strace file to this list that shows (I think)
that the request is including more than just the file name.  I'm hoping it
makes sense to someone.

Regards,

John
=====================================
On Tuesday 16 May 2017 04:19:08 Christian Hettler wrote:

> hello John,
>
> Is ChrootDir activated?
>
> regards,
>
> Christian
>
> On Mon, May 15, 2017 at 10:42:37AM -0400, John Iliffe wrote:
> > Hi Christian:
> >
> > I just noticed that you put "" around the parameters to
> > ProxyPassMatch.
> >
> > I tried that and no change in the results.
> >
> > John
> > ================================
> >
> > On Monday 15 May 2017 05:21:59 Christian Hettler wrote:
> > > Hello John,
> > >
> > > the manual (mod_proxy_fcgi.html) states:
> > >
> > > "The request URL is implicitly added to the 2nd parameter."
> > >
> > > (Did|Can) you try
> > >
> > > ProxyPassMatch "^/.*\.php(/.*)?$"
> > > "fcgi://127.0.0.1:9015/httpd/iliffe/"
> > >
> > > instead of
> > >
> > > > #   ProxyPassMatch ^/(.*\.php(/.*)?)$
> > > > fcgi://127.0.0.1:9015/httpd/iliffe/$1
> > >
> > > regards,
> > >
> > > Christian
> > >
> > > On Sat, May 13, 2017 at 03:43:08PM -0400, John Iliffe wrote:
> > > > I'm not sure is this is the correct list to post these questions
> > > > to, since I now have things isolated to a single module in
> > > > PHP-FPM, so please redirect me if necessary.  This is a
> > > > continuation of the problems I was having (on this list)
> > > > installing a new server last month.
> > > >
> > > > ---------------------
> > > > Summary: PHP-FPM will not execute any scripts; it is set up
> > > > according to the PHP-FPM Wiki documentation so far as I can see.
> > > > ---------------------
> > > >
> > > > O/S  Fedora 25, Apache 2.4.25 compiled from source, PHP 7.1.3
> > > > compiled from source.
> > > >
> > > > I did a clean install of PHP-7.1.3 for testing, PHP-FPM is running
> > > > under its own user/group phpfpm.  Set up as listen  on
> > > > 127.0.0.1:9015 in pool www.  Document root in www.conf is
> > > > /httpd/iliffe which has been set to world readable, SELinux is
> > > > set to permissive so it isn't in the equation.  Log level on PHP
> > > > is debug.  All available log info is at the end of this memo.
> > > >
> > > > It seems obvious to me that the proxy_fcgi module is worked as
> > > > expected and that the problem is somewhere in PHP-FPM.
> > > >
> > > > mod_php was tried as a check on the installation and works OK when
> > > > enabled.
> > > >
> > > > I am using the minimalist proxy configuration in Apache, (the
> > > > target PHP script is hard coded to avoid regex errors) and the
> > > > target PHP script file is being reported correctly by both Apache
> > > > and PHP-FPM. I checked by su as the phpfpm user and I can read
> > > > this file, no problems at all.
> > > >
> > > > The problem has been traced to fpm_main.c, specifically the
> > > > following:
> > > >
> > > > -----------------------------
> > > > if (UNEXPECTED(php_fopen_primary_script(&file_handle) == FAILURE))
> > > > {
> > > >
> > > > zend_try {
> > > >
> > > > zlog(ZLOG_ERROR, "Unable to open primary script: %s
(%s)",

> > > > primary_script, strerror(errno)); if (errno == EACCES) {
> > > >
> > > > SG(sapi_headers).http_response_code = 403;
> > > > PUTS("Access denied.\n");
> > > >
> > > > } else {
> > > >
> > > > SG(sapi_headers).http_response_code = 404;
> > > > PUTS("No input file specified.\n");
> > > >
> > > > --------------------------------
> > > >
> > > > Changing the script path in httpd.conf leads to a browser File Not
> > > > Found error as would be expected.  The document root in httpd.conf
> > > > and in www.conf (PHP pool conf file for this pool) are the same.
> > > >
> > > > In Apache, the minimum is set in httpd.conf:
> > > >
> > > > # Default host (www.iliffe.ca)
> > > > # This one picks up all IP based hacker garbage too
> > > > <VirtualHost *:80>
> > > >
> > > >    ServerName www.iliffe.ca
> > > >    DocumentRoot /httpd/iliffe
> > > >    Options FollowSymLinks
> > > >    H2Direct on
> > > >
> > > > #   ProxyPassMatch ^/(.*\.php(/.*)?)$
> > > > fcgi://127.0.0.1:9015/httpd/iliffe/$1
> > > >
> > > >   ProxyPassMatch ^/info$
> > > >   fcgi://127.0.0.1:9015/httpd/iliffe/i_phpinfo.php
> > > >
> > > > As far as I can see, all necessary Apache modules are loaded:
> > > >
> > > > # /usr/apache-2.4.25/bin/httpd -M
> > > >
> > > > Loaded Modules:
> > > >  core_module (static)
> > > >  so_module (static)
> > > >  http_module (static)
> > > >
> > > > **** big list of modules skipped here****
> > > >
> > > >  proxy_module (shared)
> > > >  proxy_connect_module (shared)
> > > >  proxy_http_module (shared)
> > > >  proxy_fcgi_module (shared)
> > > >  ssl_module (shared)
> > > >  unixd_module (shared)
> > > >  http2_module (shared)
> > > >  status_module (shared)
> > > >
> > > > ******more modules skipped here****
> > > >
> > > > I'm completely stuck here and any ideas or assistance would be
> > > > appreciated.
> > > >
> > > > Regards,
> > > >
> > > > John
> > > >
> > > > All following errors from one screen access:
> > > > -------------------------
> > > > PHP-FPM log:
> > > > [13-May-2017 14:40:33.423449] DEBUG: pid 16444,
> > > > fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www]
> > > > currently 0 active children, 2 spare children, 2 running children.
> > > > Spawning rate 1 [13-May-2017 14:40:34.265891] WARNING: pid 16444,
> > > > fpm_stdio_child_said(), line 197: [pool www] child 16445 said into
> > > > stderr: "ERROR: main(), line 1947: Unable to open primary script:
> > > > /httpd/iliffe/i_phpinfo.php (No such file or directory)"
> > > > [13-May-2017 14:40:34.265952] DEBUG: pid 16444, fpm_event_loop(),
> > > > line 419: event module triggered 1 events
> > > > [13-May-2017 14:40:34.424195] DEBUG: pid 16444,
> > > > fpm_pctl_perform_idle_server_maintenance(), line 379: [pool www]
> > > > currently 0 active children, 2 spare children, 2 running children.
> > > > Spawning rate 1 ----------------------------
> > > >
> > > > Apache Access Log:
> > > > 206.248.138.118 - - [13/May/2017:14:40:34 -0400] "GET /info
> > > > HTTP/1.1" 404 25 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:45.0)
> > > > Gecko/20100101 Firefox/45.0"
> > > > ------------------------------
> > > >
> > > > Apache Error Log:
> > > > [Sat May 13 14:40:34.266066 2017] [proxy_fcgi:error] [pid
> > > > 16122:tid 140525759854336] [client 206.248.138.118:57270]
> > > > AH01071: Got error 'Unable to open primary script:
> > > > /httpd/iliffe/i_phpinfo.php (No such file or directory)\n'
> > > > -------------------------------
> > > >
> > > > Browser Screen Error:
> > > >    No input file specified.
> > > >
> > > > --------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12