php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41192 Per Directory Values only work for one key
Submitted: 2007-04-25 20:22 UTC Modified: 2007-05-02 10:17 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: martin at itmission dot com Assigned: dmitry
Status: Closed Package: PHP options/info functions
PHP Version: 5.2.1 OS: Windows Server 2003
Private report: No CVE-ID:
 [2007-04-25 20:22 UTC] martin at itmission dot com
Description:
------------
I am trying to configure multiple websites under IIS using ISAPI.  For each site I would like to configure specific PHP directives.  My directives only work on the first entry I make (lexicographically, not chronologically).

Reproduce code:
---------------
Using Regedit
Add HKLM\Software\PHP\Per Directory Values\c\inetpub\www1\auto_prepend_file "c:\inetpub\www1\include1.php"
Add HKLM\Software\PHP\Per Directory Values\c\inetpub\www2\auto_prepend_file "c:\inetpub\www2\include2.php"

Files
Create c:\inetpub\www1\include1.php containing "<?php echo('1'); ?>"
Create c:\inetpub\www2\include2.php containing "<?php echo('2'); ?>"
Create c:\inetpub\www1\index.php containing "<?php echo('hello'); ?>"
Create c:\inetpub\www2\index.php containing "<?php echo('hello'); ?>"

IIS
Make the two sites (www1 and www2) and configure PHP on them.

Web Browser
Visit http://www1/index.php
Visit http://www2/index.php


Expected result:
----------------
http://www1/index.php:
1hello

http://www2/index.php:
2hello


Actual result:
--------------
http://www1/index.php:
1hello

http://www2/index.php:
hello

If I delete HKLM\Software\PHP\Per Directory Values\c\inetpub\www1, or rename it to HKLM\Software\PHP\Per Directory Values\c\inetpub\www3 http://www2/index.php changes:
2hello

However at that point www1 no longer prepends the file.  This is the case with all directives, not just auto_prepend_file.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-25 20:49 UTC] edink@php.net
As documented in http://php.net/configuration.changes the registry keys do not work with PHP_INI_PERDIR ini values.

You can see which ini value category it belongs to at: http://php.net/manual/en/ini.php#ini.list

Only those marked PHP_INI_USER or PHP_INI_ALL will work.
 [2007-04-26 01:41 UTC] martin at itmission dot com
I understand that I was wrong to try to make it work with auto_prepend_file.

When I remove auto_prepend_file and specify only display_errors => on (PHP_INI_ALL), and change my scripts to <?php phpinfo(); ?>, www1 shows Display Errors: On, and www2 shows Display Errors: off.  Deleting www1 or renaming it to www3 causes www2 to show Display Errors: on.

When I create a fake error, like trying to open a nonexistent file, www1 displays the error, while www2 does not.
 [2007-04-26 02:13 UTC] martin at itmission dot com
Possibly noteworthy, the exact same configuration works fine in PHP 5.2.0.
 [2007-04-26 03:09 UTC] martin at itmission dot com
I am assuming that it has something to do with the massive change to registry.c between 5.2.0 and 5.2.1 changelogged as "implemented registry cache that prevent registry lookup on each request. In case of modification of corresponding registry-tree PHP will reload it automatic".

Perhaps something in the way it's being cached is not working properly.  The simpler code of 5.2.0 works as expected (and it hits the registry with every request, but I can live with that).
 [2007-04-26 11:05 UTC] dmitry@php.net
The bug should be already fixed. Could you check snapshot from http://snaps.php.net
 [2007-04-26 11:32 UTC] martin at itmission dot com
I downloaded the newest Win32 Snapshot from snaps.php.net:

php5.2 (zip) (9.5M)
Built On: Apr 26, 2007 08:30 GMT

In this version of PHP (5.2.2RC2-dev), Per Directory Values do not work at all.  My phpinfo page shows display errors: off for both sites.

When I roll back to PHP-5.2.1, it works for the first website in the registry, and with PHP-5.2.0, it works for both of them.
 [2007-04-30 22:12 UTC] simon at bleif dot de
Can be reproduced in Windows Server 2003 x64 R2. Filed a bugreport regarding the same issue (see http://bugs.php.net/bug.php?id=41233).

I have to add that all entries are being read from the registry correctly (result: success in Regmon), but are not (as he already said) applied.
 [2007-05-02 10:17 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_2.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 04:02:11 2014 UTC