ID: 24420 User updated by: S dot Bennett at lancaster dot ac dot uk Reported By: S dot Bennett at lancaster dot ac dot uk -Status: Feedback +Status: Open Bug Type: Directory function related Operating System: Linux PHP Version: 4.3.3RC5-dev New Comment:
I did have some stuff in php.ini, but removing the file has made no difference (it was only stuff like "max_execution_time = 5" anyway...) I don't see how this can fail to work for you, it's clear from the code that this will happen - php_execute_script() does something like: old_cwd=getcwd(); chdir(DIR_OF_SCRIPT); EXECUTE_SCRIPT chdir(old_cwd); but all the shutdown functions are called outside of this (from php_request_shutdown()). Maybe it should be up to the SAPI module to do the chdir() stuff - some SAPI modules might not care (I'd guess that apache wouldn't care) in which case there might be a (tiny) performance gain in not doing chdir(old_cwd) at the end of a request... Previous Comments: ------------------------------------------------------------------------ [2003-08-19 04:08:28] [EMAIL PROTECTED] I can not reproduce this. Do you possibly have some php ini-settings set in your virtualhosts/some .htaccess file? (using php_value or php_admin_value) ------------------------------------------------------------------------ [2003-08-19 03:50:32] S dot Bennett at lancaster dot ac dot uk Tested this against the latest snapshot (200308190730, which describes itself as 4.3.3RC5-dev) it's still behaving as I described. ------------------------------------------------------------------------ [2003-08-14 00:36:06] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ [2003-08-03 19:17:22] aredridel at nbtsc dot org I think I'm experiencing this or a related bug: I've a page that most of the time works fine, but about 10% of the time, the require() statement at the top doesn't find the file, which is in the same directory as the script and referenced with a simple relative path -- require('filename.inc') ------------------------------------------------------------------------ [2003-06-30 13:44:17] S dot Bennett at lancaster dot ac dot uk Description: ------------ The current working directory seems to set to random values under certain circumstances. e.g. getcwd() returns inconsistent values (as shown in the sample code) and attempts to reference files by relative paths work intermittently or not at all (which is how I discovered this bug..). Other variations on this code (eg calling getcwd() from an ob_start() callback) appear to give similar results. The code works fine from the command line (ie produces the expected result). I've configured PHP with the following, and still been able to reproduce the result: ./configure --prefix=/usr/local/packages/php-4.3.2 --with-apxs=/usr/local/packages/apache-1.3.27/bin/apxs I've also reproduced this problem on a Solaris box, also running Apache 1.3.27. Reproduce code: --------------- <?PHP print "current time is '".strftime("%D %T")."'<br>\n"; print "(in main) cwd is '".getcwd()."'<br>\n"; register_shutdown_function("atexit"); function atexit() { print "(in callback) cwd is '".getcwd()."'<br>\n"; } ?> Expected result: ---------------- Something like: current time is '06/30/03 18:39:24' (in main) cwd is '/home/steveb/public_html/callbacktest' (in callback) cwd is '/home/steveb/public_html/callbacktest' Actual result: -------------- actual results vary, here's two. All I did in between them was press 'reload'... output 1: --------- current time is '06/30/03 18:59:24' (in main) cwd is '/home/steveb/public_html/callbacktest' (in callback) cwd is '/home/www/vhosts/nutter.spoo.org/htdocs' output 2: --------- current time is '06/30/03 18:59:34' (in main) cwd is '/home/steveb/public_html/callbacktest' (in callback) cwd is '/home/steveb/public_html' The values returned by getcwd() appear to be related to previous pages that have been served by apache (not necessarily ones that have been processed by PHP). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24420&edit=1