note 92657 added to function.register-shutdown-function

From: Date: Sun, 02 Aug 2009 21:25:44 +0000
Subject: note 92657 added to function.register-shutdown-function
Groups: php.notes 
Request: Send a blank email to php-notes+get-159017@lists.php.net to get a copy of this message
You definitely need to be careful about using relative paths in after the shutdown function has been called, but the current working directory doesn't (necessarily) get changed to the web server's ServerRoot - I've tested on two different servers and they both have their CWD changed to '/' (which isn't the ServerRoot). This demonstrates the behaviour: <? function echocwd() { echo 'cwd: ', getcwd(), "\n"; } register_shutdown_function('echocwd'); echocwd() and exit; ?> Outputs: cwd: /path/to/my/site/docroot/test cwd: / NB: CLI scripts are unaffected, and keep their CWD as the directory the script was called from. ---- Server IP: 87.124.35.190 Probable Submitter: 78.86.196.155 ---- Manual Page -- http://www.php.net/manual/en/function.register-shutdown-function.php Edit -- https://master.php.net/note/edit/92657 Del: integrated -- https://master.php.net/note/delete/92657/integrated Del: useless -- https://master.php.net/note/delete/92657/useless Del: bad code -- https://master.php.net/note/delete/92657/bad+code Del: spam -- https://master.php.net/note/delete/92657/spam Del: non-english -- https://master.php.net/note/delete/92657/non-english Del: in docs -- https://master.php.net/note/delete/92657/in+docs Del: other reasons-- https://master.php.net/note/delete/92657 Reject -- https://master.php.net/note/reject/92657 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159017) next »