Re: [users@httpd] Getting PHP-FPM working

2017-05-22 Thread Christian Hettler
Hello John,

I think you should try it on an php related list.

sorry,

Christian

On Sat, May 20, 2017 at 01:15:36PM -0400, John Iliffe wrote:
> 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( 
> 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}},  
> 9222  12:25:52 read(10,  
> 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 
> 
> 9222  12:25:52 write(3, "[20-May-2017 12:25:52] WARNING: "..., 169 
> 
> 
> 
> 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
> > 

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Getting PHP-FPM working

2017-05-19 Thread Christian Hettler
Hello John,

".user.ini" is for "user-defined php.ini (.htaccess) files". It's mentioned
in /etc/php5/fpm/php.ini on my plattform. It doesn't matter if it's missing.

Is php-fpm configured with chroot?

regards,

Christian

On Thu, May 18, 2017 at 10:44:41AM -0400, John Iliffe wrote:
> Hi Christian:
> 
> Result:  "No Input File Specified"
> 
> First, thanks for spending the time to explain this to me.  To some extent 
> you are saying what I had already thought but I figured I must be missing 
> something!
> 
> The details:
> 
> Your second example seems to match exactly what I want to do so I cut and 
> pasted from your memo to be sure of no typing errors.
> 
>  ProxyPassMatch "^/.*\.php(/.*)?$" fcgi://127.0.0.1:9015/httpd/iliffe/
> 
> I note that there is no '/$1' ending on your directive, which differs from 
> the wiki example.  
> 
> So, I ran strace and here is what was actually requested (about 24000 lines 
> skipped here):
> 
> ---
> lstat("/httpd/iliffe//i_phpinfo.php", {st_mode=S_IFREG|0644, st_size=213, 
> ...}) = 0
> 2 10:06:25 lstat("/httpd/iliffe", {st_mode=S_IFDIR|0755, st_size=4096, 
> ...}) = 0
> 2 10:06:25 lstat("/httpd", {st_mode=S_IFDIR|0755, st_size=141, ...}) = 
> 0
> 2 10:06:25 lstat("/httpd/iliffe/.user.ini", 0x7b866e90) = -1 ENOENT 
> (No such file or directory)
> 
> 
> Notice that the initial lstat is correct, (ignoring the double '/', but 
> this doesn't seem to cause a problem) and the response is 0, indicating 
> that it got the file OK.  
> 
> So, why does it continue to stat the subdirectory and the root directory?  
> And what is the .user.ini that it needs?
> 
> Just to be complete, here is the PHP log entry:
> 
> [18-May-2017 10:06:25] WARNING: [pool www] child 2 said into stderr: 
> "ERROR: Unable to open primary script: /httpd/iliffe//i_phpinfo.php (No such 
> file or directory)"
> 
> and the httpd log entry:
> 
> [Thu May 18 10:06:25.958856 2017] [proxy_fcgi:error] [pid 29694:tid 
> 140326128224000] [client 206.248.138.118:49284] AH01071: Got error 'Unable 
> to open primary script: /httpd/iliffe//i_phpinfo.php (No such file or 
> directory)\n
> 
> and, just to show it does exist:
> 
> namei /httpd/iliffe/i_phpinfo.php
> f: /httpd/iliffe/i_phpinfo.php
>  d /
>  d httpd
>  d iliffe
>  - i_phpinfo.php
> 
> this last done from user phpfpm which is the user/group that php-fpm is 
> running under.
> 
> Seems that there is something I don't have but I have revisited the 
> documentation a number of times, especially the wiki, and there is nothing 
> that suggests I need any .ini files.
> 
> Regards,
> 
> 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
> > 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Getting PHP-FPM working

2017-05-18 Thread Christian Hettler
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

On Wed, May 17, 2017 at 10:59:38AM -0400, John Iliffe wrote:
> 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

Re: [users@httpd] Getting PHP-FPM working

2017-05-17 Thread Christian Hettler
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  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-unsubscr...@httpd.apache.org
> > For additional commands, e-mail: users-h...@httpd.apache.org

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Getting PHP-FPM working

2017-05-16 Thread 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(_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
> > > 
> > > 
> > >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

Re: [users@httpd] Getting PHP-FPM working

2017-05-15 Thread Christian Hettler
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(_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
> 
>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] 

Re: [users@httpd] Rewrite domain to language specific page but no address bar redirection

2016-03-30 Thread Christian Hettler
Hello Alexandru,

On Tue, Mar 29, 2016 at 01:23:54PM +0300, Alexandru Duzsardi wrote:
> I'm not sure what you mean
> For now I can't figure it out why does it behave like this ... if I try to 
> access http://lang-fr.domain.com/ It says that /fr/index.php does not exist , 
> I would like it to no try to find an index just access the path specified 
> 
> Regarding the PT flag , did you mean something like this ?

Yes. After a [PT]-Rule matches config processing will "start" again to process 
Alias, ScriptAlias and co.
Without [PT] no Alias processing happens and the result should/must be a file 
path.

> 
> # fr-lang 
> RewriteCond %{ENV:REDIRECT_STATUS} ^$
> RewriteCond %{REQUEST_URI} ^/fr$
> RewriteRule ^fr$ http://lang-fr.hostname.com/ [L,R=302]
> 
> RewriteCond %{ENV:REDIRECT_STATUS} ^$
> RewriteCond %{REQUEST_URI} ^/fr/.*$
> RewriteRule ^fr/(.*)$ http://lang-fr.hostname.com/$1 [L,R=302]
> 
> RewriteCond %{HTTP_HOST} ^www\.lang-fr\.hostname\.com$ [NC] 
> RewriteRule ^(.*)$ http://lang-fr.hostname.com/$1 [R=301,L]
> 
> RewriteCond %{HTTP_HOST} ^lang-fr\.hostname\.com$ [NC] 
> RewriteCond %{REQUEST_URI} !^/fr/.*$ 
> RewriteRule ^(.*)$ /fr/$1 [PT,L]
> 
> RewriteCond %{HTTP_HOST} ^lang-fr\.hostname\.com$ [NC] 
> RewriteRule ^(.*)$ - [PT,L]
> 
> # fr-lang 
> 

BTW: do you know mod_macro? It may improve the administion of your config for 
different lang.

Christian

> 
> Thank you!
> 
> 
> -Original Message-
> From: Christian Hettler [mailto:christian.hett...@asknet.de] 
> Sent: Tuesday, March 29, 2016 12:08 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Rewrite domain to language specific page but no 
> address bar redirection
> 
> did you check the flag [PT] for RewriteRule?
> 
> Christian
> 
> On Fri, Mar 25, 2016 at 04:27:46PM +0200, Alexandru Duzsardi wrote:
> > I tested a bit more , and unfortunately it breaks somewhere Probably I 
> > should have mentioned that the path’s after  ….hostname.com/  are not 
> > always physical paths on the disk , actually I think like 95% are not 
> > For example lang-fr.hostname.com/user/  , lang-fr.hostname.com/admin , 
> > lang-fr.hostname.com/admin/modules
> > or
> > hostname.com/fr/user , hostname.com/fr/admin , hostname.com/admin , 
> > hostname.com/admin/modules or lang-fr.hostname.com/fr/user , 
> > lang-fr.hostname.com/fr/admin , lang-fr.hostname.com/fr/admin/modules
> > 
> > And deeper paths are generated by drupal , and there is no index file 
> > , just the path
> > 
> > I tried to do this to remove the index.php file from the path , and 
> > this works but deeper paths don’t
> > 
> >   RewriteCond %{HTTP_HOST} ^lang-fr\.hostname\.com$ [NC]
> >   RewriteCond %{REQUEST_URI} !^/fr/.*$
> >   RewriteCond %{THE_REQUEST} ^GET.*index\.php$ [NC]
> >   RewriteRule ^(.*)index\.php/*(.*)$ /fr/$2 [L]
> > 
> > From: Marat Khalili [mailto:m...@rqc.ru]
> > Sent: Friday, March 25, 2016 2:31 PM
> > To: users@httpd.apache.org
> > Subject: Re: [users@httpd] Rewrite domain to language specific page 
> > but no address bar redirection
> > 
> > It's tricky. Here's a rule set that works for me (but it may depend on 
> > Apache version and configuration):
> > 
> > # fr-lang {
> >   RewriteCond %{ENV:REDIRECT_STATUS} ^$
> >   RewriteCond %{REQUEST_URI} ^/fr$
> >   RewriteRule ^fr$ http://lang-fr.hostname.com/ [L,R=302]
> > 
> >   RewriteCond %{ENV:REDIRECT_STATUS} ^$
> >   RewriteCond %{REQUEST_URI} ^/fr/.*$
> >   RewriteRule ^fr/(.*)$ http://lang-fr.hostname.com/$1 [L,R=302]
> > 
> >   RewriteCond %{HTTP_HOST} ^www\.lang-fr\.hostname\.com$ [NC]
> >   RewriteRule ^(.*)$ http://lang-fr.hostname.com/$1 [R=301,L]
> > 
> >   RewriteCond %{HTTP_HOST} ^lang-fr\.hostname\.com$ [NC]
> >   RewriteCond %{REQUEST_URI} !^/fr/.*$
> >   RewriteRule ^(.*)$ /fr/$1 [L]
> > 
> >   RewriteCond %{HTTP_HOST} ^lang-fr\.hostname\.com$ [NC]
> >   RewriteRule ^(.*)$ - [L]
> > # fr-lang }
> > 
> > Repeat for each language (probably it's possible to make a single rule set 
> > for all languages, but I didn't try it).
> > --
> > 
> > With Best Regards,
> > Marat Khalili
> > 
> > 
> > 
> > On 25/03/16 11:13, Alexandru Duzsardi wrote:
> > Hello,
> > I’ve search around on search engines but I could not find any answers 
> > that solve my dilemma I have a VirtualHost configured to respond on 
> > multiple hostnames
> > Example: hostname.com , lang-fr.hostname.com , lang-nl.hostname.com , 
> > fr-lang.hostname.com , nl-lang.hostname.com Now

Re: [users@httpd] Rewrite domain to language specific page but no address bar redirection

2016-03-29 Thread Christian Hettler
did you check the flag [PT] for RewriteRule?

Christian

On Fri, Mar 25, 2016 at 04:27:46PM +0200, Alexandru Duzsardi wrote:
> I tested a bit more , and unfortunately it breaks somewhere 
> Probably I should have mentioned that the path’s after  ….hostname.com/  are 
> not always physical paths on the disk , actually I think like 95% are not 
> For example 
> lang-fr.hostname.com/user/  , lang-fr.hostname.com/admin , 
> lang-fr.hostname.com/admin/modules 
> or
> hostname.com/fr/user , hostname.com/fr/admin , hostname.com/admin , 
> hostname.com/admin/modules
> or
> lang-fr.hostname.com/fr/user , lang-fr.hostname.com/fr/admin , 
> lang-fr.hostname.com/fr/admin/modules
> 
> And deeper paths are generated by drupal , and there is no index file , just 
> the path
> 
> I tried to do this to remove the index.php file from the path , and this 
> works but deeper paths don’t
> 
>   RewriteCond %{HTTP_HOST} ^lang-fr\.hostname\.com$ [NC]
>   RewriteCond %{REQUEST_URI} !^/fr/.*$
>   RewriteCond %{THE_REQUEST} ^GET.*index\.php$ [NC]
>   RewriteRule ^(.*)index\.php/*(.*)$ /fr/$2 [L]
> 
> From: Marat Khalili [mailto:m...@rqc.ru] 
> Sent: Friday, March 25, 2016 2:31 PM
> To: users@httpd.apache.org
> Subject: Re: [users@httpd] Rewrite domain to language specific page but no 
> address bar redirection
> 
> It's tricky. Here's a rule set that works for me (but it may depend on Apache 
> version and configuration):
> 
> # fr-lang {
>   RewriteCond %{ENV:REDIRECT_STATUS} ^$
>   RewriteCond %{REQUEST_URI} ^/fr$
>   RewriteRule ^fr$ http://lang-fr.hostname.com/ [L,R=302]
> 
>   RewriteCond %{ENV:REDIRECT_STATUS} ^$
>   RewriteCond %{REQUEST_URI} ^/fr/.*$
>   RewriteRule ^fr/(.*)$ http://lang-fr.hostname.com/$1 [L,R=302]
> 
>   RewriteCond %{HTTP_HOST} ^www\.lang-fr\.hostname\.com$ [NC]
>   RewriteRule ^(.*)$ http://lang-fr.hostname.com/$1 [R=301,L]
> 
>   RewriteCond %{HTTP_HOST} ^lang-fr\.hostname\.com$ [NC]
>   RewriteCond %{REQUEST_URI} !^/fr/.*$
>   RewriteRule ^(.*)$ /fr/$1 [L]
> 
>   RewriteCond %{HTTP_HOST} ^lang-fr\.hostname\.com$ [NC]
>   RewriteRule ^(.*)$ - [L]
> # fr-lang }
> 
> Repeat for each language (probably it's possible to make a single rule set 
> for all languages, but I didn't try it).
> --
> 
> With Best Regards,
> Marat Khalili
> 
> 
> 
> On 25/03/16 11:13, Alexandru Duzsardi wrote:
> Hello,
> I’ve search around on search engines but I could not find any answers that 
> solve my dilemma
> I have a VirtualHost configured to respond on multiple hostnames 
> Example: hostname.com , lang-fr.hostname.com , lang-nl.hostname.com , 
> fr-lang.hostname.com , nl-lang.hostname.com
> Now , what I would like is that 
> If somebody is accessing lang-fr.hostname.com and fr-lang.hostname.com to 
> actually  see the pages under hostname.com/fr/… but without redirection 
> Like lang-fr.hostname.com/users to actually be hostname.com/fr/users , and so 
> on for other languages.
>  
> I’ve tried some things but always get to many redirects or some other error 
> and can’t figure it out why is that happening , but if I had to guess is 
> because I’m using RewriteCond  correctly.
>  
> Thank you in advance!
>  
>  
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
> 

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Directory matching when Location should match

2015-07-24 Thread Christian Hettler
hello Andy,

one possible solution to your problem will be
an additional VirtualHost on port 80 for server-status.

Christian
-- 
asknet AG * Vincenz-Priessnitz-Str. 3 * D-76131 Karlsruhe
fon: +49 721 96458 6445 * fax: +49 721 96458 9445 * web: http://www.asknet.com
executive board: Tobias Kaulfuss (CEO), Ute Imhof (COO)
chairman of the supervisory board: Dr. Joachim Bernecker * HRB 108713 Mannheim

On Thu, Jul 23, 2015 at 03:45:06PM +0200, Andreas Ley wrote:
 Hello!
 
 I have a configuration (apache 2.2, soon 2.4) which basically is
 
 VirtualHost 10.1.2.3:80
 DocumentRoot /var/www
 Location /server-status
 SetHandler server-status
 /Location
 Directory /var/www/
 RewriteEngine On
 RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI}
 /Directory
 /VirtualHost
 
 (of course there is another VirtualHost on port 443)
 
 I want to redirect all requests for _filesystem_ objects to a secure
 connection, but the non-filesystem object served via a handler should
 be available unencrypted. (FYI: I use the server-status for health
 check by a loadbalancer, but the documents are protected by shibboleth)
 
 However, also requests for /server-status get redirected :( Documentation
 says Enclose a group of directives that apply only to the named file-system
 directory, sub-directories, and their contents. Cleary /server-status is
 not within /var/www ...
 
 My naive imagination would be that apache performs a url-to-filesystem-
 path conversion, and only if the outcome really is a directory or a file,
 then applies the corresponding directives. Either this is not the case,
 or I'm missing something completly :(
 
 There is a hidden hint in the docs for RewriteCond:
 REQUEST_FILENAME The full local filesystem path to the file or script
 matching the request, if this has already been determined by the server
 at the time REQUEST_FILENAME is referenced. Otherwise, such as when used
 in virtual host context, the same value as REQUEST_URI. Depending on the
 value of AcceptPathInfo, the server may have only used some leading
 components of the REQUEST_URI to map the request to a file.
 
 After reading this, I tried
 RewriteCond %{LA-U:REQUEST_FILENAME} /var/www/.*
 with no effect :(
 
 Is there anybody familiar enough with how apache's working to explain
 what's happening here? Or better yet, does somebody have any idea how
 to accomplish what I'm seeking to do, i.e. redirecting all filesystem
 objects while leaving alone all virtual URLs?
 
 TIA, Andy
 
 -- 
 Andreas Ley, SCC, Karlsruhe Institute of Technology (KIT), D-76128 Karlsruhe
 E-Mail: andreas@kit.edu, Telephone: +49 721 608 46341, Fax: +49 721 32550
 From the home of the imaginary deadlines:
 It will take 2i weeks to do that project.   -- Michael Sinz
 
 -
 To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
 For additional commands, e-mail: users-h...@httpd.apache.org
 

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [us...@httpd] Custom authentication?

2011-01-05 Thread Christian Hettler
On Tue, Jan 04, 2011 at 11:19:01AM +, Oliver Beattie wrote:
 Hi there,
 
 I am sure this question has likely been asked many times before, I'm just
 having a bit of a hard time finding answers.
 
 Basically, I need to be able to authenticate downloads based on a URL
 signature if present (passed as a query parameter), instead of via Basic
 authentication (I need to support both of these, but bypass the basic auth
 if no signature is present). It isn't a requirement that they live at the
 same path, so they can be at different virtual hosts/directories if
 necessary.
 
 At first, I thought the best way to do this would be just through a simple
 CGI/WSGI/whatever, but the files I am authenticating access to are very
 large (many GB) and I fear there may be a performance implication of doing
 this (and things like Range requests won't be possible without extra work).
 
 Has anyone had any experience with this? What is the best way to proceed?
 Any help anyone could give would be very much appreciated :)
 
 —Oliver

Hello Oliver,

do you know mod_auth_token?

Christian
-- 
asknet AG * Vincenz-Priessnitz-Str. 3 * D-76131 Karlsruhe
fon: +49 721 96458 6445 * fax: +49 721 96458 9445 * web: http://www.asknet.com
board of managing directors: Michael Scheib, Dr. Dietmar Waudig, Michael Konrad
chairman of the supervisory board: Dr. Joachim Bernecker * HRB 108713 Mannheim

-
The official User-To-User support forum of the Apache HTTP Server Project.
See URL:http://httpd.apache.org/userslist.html for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
  from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org