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 Wed, 17 May 2017 14:59:38 GMT
Hi Christian:

It didn't work and I think there is something that I am failing to 
understand here so, with your forbearance, let me explain my set up and 
what I'm actually trying to do.  I got a "Not Found" error when I tried 
your suggestion.

Configuration:

on directory /httpd are the document root directories for as number of 
virtual hosts.  My test server, www.iliffe.ca, for example, has document 
root on /httpd/iliffe.  There is a PHP script   there called i_phpinfo.php.

For testing purposes, I am using the minimalist matching line suggested in 
the php-fpm wiki entry:

  ProxyPassMatch ^/info$ fcgi://127.0.0.1:9000/var/www/info.php

which, on this machine, translates to:

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

My understanding is that this should match "http://www.iliffe.ca/info" and 
nothing else, and that it should pass exactly "httpd/iliffe/i_phpinfo.php" 
to the TCP socket 127.0.0.1:9015  .   That isn't what showed up in the 
trace as you have noted.  Specifically, the original "info" was passed as 
the script to be executed which is not what I would have expected.

According to the wiki, the absolute path to the script is the bit following 
the socket number in the ProxyPassMatch directive and that is exactly the 
script path/location on this machine.

From the wiki:
-------------
/path/to/your/documentroot/

IMPORTANT! This must exactly match the real filesystem location of your php 
files, because that is where the php-fpm daemon will look for them.
php-fpm just interprets the php files passed to it; it is not a web server, 
nor does it understand your web servers' namespace, virtualhost layout, or 
aliases.
--------------

So, what am I missing?  To me this looks like it should send everything 
that ends in "info" to the phpinfo script on the document root directory.

Regards,

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

On Wednesday 17 May 2017 03:31:01 Christian Hettler wrote:
> hello John,
> 
> a Proxy-request didn't rewrite the url.
> 
> If you have http://my.example.com/myapp/script.php
> then you can configure with ProxyPassMatch:
> 
> ProxyPassMatch "^/myapp/.*\.php(/.*)?$" "fcgi://localhost:9000/var/www/"
> 
> where script.php is located at /var/www/myapp/script.php
> The parenthesis above aren't used to remember anything but to match
> everything after ".php".
> 
> The layout of the directory within the fcgi environment must match
> the layout of the url path.
> 
> One more excerpt from the manual:
> 
> "
> The following example passes the request URI as a filesystem path for
> the PHP-FPM daemon to run. The request URL is implicitly added to the
> 2nd parameter. The hostname and port following fcgi:// are where
> PHP-FPM is listening. Connection pooling is enabled. PHP-FPM
> 
> ProxyPassMatch "^/myapp/.*\.php(/.*)?$" "fcgi://localhost:9000/var/www/"
> enablereuse=on
> 
> "
> 
> In your environment you can request http://your.server/i_phpinfo.php
> 
> regards,
> 
> Christian
> 
> On Tue, May 16, 2017 at 12:05:06PM -0400, John Iliffe wrote:
> > 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 <john.iliffe@iliffe.ca>

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: users-unsubscribe@httpd.apache.org
> > > For additional commands, e-mail: users-help@httpd.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

Mime
View raw message