Why getcwd() returs different results?

View: New views
3 Messages — Rating Filter:   Alert me  

Why getcwd() returs different results?

by Raymond Irving :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: Why getcwd() returs different results?

by Ashley Sheridan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



Re: Why getcwd() returs different results?

by Raymond Irving :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <ash@...>
To: Raymond Irving <xwisdom@...>
Cc: PHP-General List <php-general@...>
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