Here's an example from the PHP website: This demonstrates the behaviour:
<?php function echocwd() { echo 'cwd: ', getcwd(), "\n"; } echocwd(); register_shutdown_function('echocwd'); ?> Outputs: cwd: /path/to/my/site/docroot/test cwd: / http://php.net/manual/en/function.register-shutdown-function.php It's a known problem but I can't see why this can't be fixed ________________________________ From: Ashley Sheridan <a...@ashleysheridan.co.uk> To: Raymond Irving <xwis...@yahoo.com> Cc: PHP-General List <php-general@lists.php.net> Sent: Thu, November 5, 2009 6:09:19 AM Subject: Re: [PHP] Why getcwd() returs different results? On Wed, 2009-11-04 at 17:36 -0800, Raymond Irving wrote: Hello, > >The getcwd() method returns a different path when called from inside a >shutdown function under Apache. On windows IIS it works just fine. > >Can't this be fixed so that the path returned is consistent across servers? > >It would appear that PHP should set the CWD path before calling the shut down >functions > >__ >Raymond Irving > What shutdown functions are you meaning? Do you have an example which shows the problem? Thanks, Ash http://www.ashleysheridan.co.uk