php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55726 Changing the working directory makes router script inaccessible
Submitted: 2011-09-19 12:13 UTC Modified: 2011-09-20 07:06 UTC
From: thomas at weinert dot info Assigned: laruence (profile)
Status: Closed Package: Built-in web server
PHP Version: 5.4.0beta1 OS: Windows
Private report: No CVE-ID: None
 [2011-09-19 12:13 UTC] thomas at weinert dot info
Description:
------------
A router script that calls 'chdir()' to set the working directory for scripts in subdirectories is not found in the next request.

The first request works fine, but the second request outputs an error.

The problem can be avoided using an absolute path for the router script in command line.

Test script:
---------------
<?php

// a subdirectory "admin" is needed 
chdir(__DIR__.'/admin');

echo 'Hallo Welt';

Expected result:
----------------
Hallo Welt

Actual result:
--------------
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required 'chdir-bug.php' (include_path='.;C:\php\pear') in Unknown on line 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-20 07:04 UTC] [email protected]
-Assigned To: +Assigned To: laruence
 [2011-09-20 07:06 UTC] [email protected]
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=317040
Log: Fix Bug #55726 (Changing the working directory makes router script inaccessible)
 [2011-09-20 07:06 UTC] [email protected]
-Status: Assigned +Status: Closed
 [2011-09-20 07:06 UTC] [email protected]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-04-18 09:48 UTC] [email protected]
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=eb233a26f7c9d9eb58dd5c1c0363310982bf0350
Log: Fix Bug #55726 (Changing the working directory makes router script inaccessible)
 [2012-07-24 23:39 UTC] [email protected]
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=eb233a26f7c9d9eb58dd5c1c0363310982bf0350
Log: Fix Bug #55726 (Changing the working directory makes router script inaccessible)
 [2013-11-17 09:36 UTC] [email protected]
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=eb233a26f7c9d9eb58dd5c1c0363310982bf0350
Log: Fix Bug #55726 (Changing the working directory makes router script inaccessible)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 31 04:00:01 2025 UTC