|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #64865 Search for .user.ini files from script dir up to CONTEXT_DOCUMENT_ROOT
Submitted: 2013-05-17 08:55 UTC Modified: 2020-10-19 09:26 UTC
Avg. Score:4.2 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (66.7%)
From: php-bugs at sievers dot dialup dot fu-berlin dot de Assigned:
Status: Re-Opened Package: CGI/CLI related
PHP Version: 5.5Git-2013-05-17 (Git) OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-05-17 08:55 UTC] php-bugs at sievers dot dialup dot fu-berlin dot de
Currently PHP-CGI searches for .user.ini files in the script directory and all parent directories up to DOCUMENT_ROOT.


If Apache web servers use the UserDir module the php scripts lie out of the DOCUMENT_ROOT, which causes PHP-CGI to search only in the script directory for .user.ini files. This is inconvenient for users, who have to copy their .user.ini files to all sub-directories in order to apply their settings.

Since Apache 2.3.13 there is an additional CONTEXT_DOCUMENT_ROOT variable, which is set by mod_userdir and probably mod_alias accordingly.


PHP-CGI could use this variable (if set) to search for .user.ini files. It could search from the script directory up to CONTEXT_DOCUMENT_ROOT. If the variable is not set, PHP-CGI should use DOCUMENT_ROOT as it has before.

Even other web servers (e.g. Apache 2.2) can profit from this change, since it's easy to set CONTEXT_DOCUMENT_ROOT variable via a RewriteRule directive.

Apache http's suexec support the CONTEXT_DOCUMENT_ROOT variable too:

  *) suexec: Add environment variables CONTEXT_DOCUMENT_ROOT, CONTEXT_PREFIX,
     whitelist in suexec. PR 51499. [Graham Laverty <graham reg ca>,
     Stefan Fritsch]


Jan Sievers


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-03 15:53 UTC] willypbender83 at gmail dot com
The following pull request has been associated:

Patch Name: Use CONTEXT_DOCUMENT_ROOT for scanning dir tree
On GitHub:
 [2020-01-24 14:34 UTC]
Automatic comment on behalf of
Log: Fix bug #64865: Use CONTEXT_DOCUMENT_ROOT for scanning dir tree
 [2020-01-24 14:34 UTC]
-Status: Open +Status: Closed
 [2020-02-20 15:14 UTC] iggyvolz at gmail dot com
Is there any way this could be backported to 7.4?
 [2020-10-19 09:25 UTC]
Automatic comment on behalf of
Log: Revert &quot;Fix bug #64865: Use CONTEXT_DOCUMENT_ROOT for scanning dir tree&quot;
 [2020-10-19 09:26 UTC]
-Status: Closed +Status: Re-Opened
 [2020-10-19 09:26 UTC]
Re-opening as the change has been reverted due to bug #80113.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 07:01:29 2024 UTC