php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55322 Apache : TRANSLATED_PATH doesn't consider chroot
Submitted: 2011-07-30 00:37 UTC Modified: 2017-10-24 07:44 UTC
Votes:17
Avg. Score:4.8 ± 0.5
Reproduced:15 of 15 (100.0%)
Same Version:6 (40.0%)
Same OS:11 (73.3%)
From: gregoire dot leroy at retenodus dot net Assigned:
Status: Open Package: FPM related
PHP Version: 5.3.6 OS: Debian
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gregoire dot leroy at retenodus dot net
New email:
PHP Version: OS:

 

 [2011-07-30 00:37 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-02 01:16 UTC] fat@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: fat
 [2011-08-02 01:30 UTC] 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.
 [2012-04-03 07:12 UTC] 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
 [2012-06-11 17:35 UTC] graham at wyenet dot co dot uk
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.
 [2017-10-24 07:44 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: fat +Assigned To:
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC