Bug #55322 [Com]: Apache : TRANSLATED_PATH doesn't consider chroot

From: Date: Mon, 11 Jun 2012 17:35:03 +0000
Subject: Bug #55322 [Com]: Apache : TRANSLATED_PATH doesn't consider chroot
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-171203@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55322&edit=1

 ID:                 55322
 Comment by:         graham at wyenet dot co dot uk
 Reported by:        gregoire dot leroy at retenodus dot net
 Summary:            Apache : TRANSLATED_PATH doesn't consider chroot
 Status:             Assigned
 Type:               Bug
 Package:            FPM related
 Operating System:   Debian
 PHP Version:        5.3.6
 Assigned To:        fat
 Block user comment: N
 Private report:     N

 New Comment:

In PHP 5.3.10 and PHP 5.3.13, it will work find if fix.cgi_pathinfo is set to 0, but then many off
the shelf applications will fail, as the server variables are then not set correctly. This is true
even if the symbolic link trick is not implemented.

The variables can be fixed with an prepended script, but this adds a little latency to each request.
 
Is it not possible to add a directive fix.cgi_pathinfo_chroot which would then take the php-fpm
chroot directory and use use that to correct the actual document root received from apache /
mod_fastcgi etc.


Previous Comments:
------------------------------------------------------------------------
[2012-04-03 07:12:21] me at paw-e-l dot net

The problem with chroot is that its path is added to apache document root. Workaround is quite
nasty. Let me explain using example.

Your site is in /var/www/yoursite/public_html (this is DocumentRoot in apache virtual host with
yoursite.com domain).
In fpm pool config chroot = /var/www/yoursite
Now when you request http://yoursite.com/index.php fpm
looks for that file under /var/www/yoursite/var/www/yoursite/public_html/index.php so the path to
file is concatinated chroot path and DocumentRoot.
To make it work create following catalogs structure /var/www/yoursite/var/www/yoursite/public_html
and one symlink /var/www/yoursite/public_html pointing to
/var/www/yoursite/var/www/yoursite/public_html

------------------------------------------------------------------------
[2011-08-02 01:30:30] gregoire dot leroy at retenodus dot net

Hem... On pastebin links, you can ignore AliasMatch directive. I tried this directive as solution
but even without AliasMatch it didn't work.

------------------------------------------------------------------------
[2011-07-30 00:37:21] gregoire dot leroy at retenodus dot net

Description:
------------
I use Apache and mod_fastcgi and I use PHP-FPM via a socket. I try to use the chroot directive.

When I don't use the chroot directive, the setup works fine. But when I use the chroot
directive, I've an Apache error : File does not exist: /index.php

My vhost config : http://pastebin.com/fmCJQUsS
My pool config : http://pastebin.com/9NqEjEft

I think it's due to the fact that TRANSLATED_PATH doesn't consider the chroot.

We could add a directive "chroot_translated_path", which, when activated, would truncate
the PATH_TRANSLATED.

Actual result:
--------------
Apache log :
[error] File does not exist: /index.php



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



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55322&edit=1


Thread (6 messages)

« previous php.bugs (#171203) next »