|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41233 "Per Directory Values" are not applied correctly
Submitted: 2007-04-30 02:50 UTC Modified: 2007-04-30 21:57 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: simon at bleif dot de Assigned:
Status: Not a bug Package: IIS related
PHP Version: 5.2.1 OS: Windows Server 2003 x64 R2 SP2
Private report: No CVE-ID:
 [2007-04-30 02:50 UTC] simon at bleif dot de
According to, you are able to change parts of the PHP-configuration on a per-directory-manner.
After setting the desired configuration options there and restarting IIS, only the options for the first folder (if there are some "folders"/registry keys within the same "folder"/key each configured with individual options) are applied.
A trace with Regmon shows the W3WP enumerating and (successfully) accessing all entries under the "Per Directory Values"-hive.

Reproduce code:
Setup at least 2 virtul hosts (located under C:\Inetpub\wwwroot\a and C:\Inetpub\wwwroot\b).
Start Regedit, navigate to the key HKLM\Software\PHP (HKLM\Software\Wow6432Node\PHP if you are on x64), create the subkey "Per Directory Values". This key gets a new subkey named "c", that key gets one named "Inetpub", that one gets a subkey named "wwwroot".
Now you create two keys (one named "a", the other one named "b") directly below the key "wwwroot".
Now, create a new string value called for example "log_errors" in both of these keys and set that value to the opposite of the value defined in the php.ini (for example 0).
Restart IIS, place a file named test.php in both physical virtual host directory containing the following:
echo 'log_errors = ' . ini_get('log_errors');
echo 'log_errors2 = ' . get_cfg_var('log_errors');

If you now launch your web browser, point it to virtual host A, the correct values (as they were set in the registry) are being displayed.
If you do the same with host B, the default values (as set in the php.ini or a registry key above the virtual host B configuration-key) (or NULL) are beeing displayed, not the setting defined in the registry.

If you now delete the key "a" in the registry and restart IIS, the correct value is displayed when you point your browser to virtual host B. If you create a third virtual host C (folder: c), the settings stored in the registry are applied only if there are no other hosts-settings defined before (in alphabetical order, starting with a) that host in the same registry-key.

The same issue also appears on a second server (same OS, same versions, but different php.ini).
The issue applies both in safe- and non-safe mode.

Expected result:
The settings are being applied correctly on a per folder-level.

Actual result:
The settings are only applied to the first (in alphabetical order) configured folder in a directory. Further details please see under "Reproduce code".


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-30 13:22 UTC]
Please try using this CVS snapshot:
For Windows:

 [2007-04-30 21:38 UTC] simon at bleif dot de
Thank you for your reply.

Unfortunately, things are now broken completely in that snapshot - although all values are being read from the registry, none of them are being applied (not even in .php-files located in the first folder).
 [2007-04-30 21:57 UTC]
Duplicate of bug #41192.
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sat Mar 25 04:01:43 2017 UTC