My client is trying to move his website on his new server but we've come across a really weird problem.
The script is located in: e:\sites\www.domain.com\
getcwd() returns sometimes e:\sites\www.domain.com\demo\mega and sometimes C:\WINDOWS\system32\inetsrv
Both of these directories are wrong, getcwd() should return e:\sites\www.domain.com\
There seems to be something wrong also with functions like opendir, they always worked before now they seem to fail.
Some info about the server:
PHP Version 4.4.9
Windows NT 5.2 build 3790
ISAPI
Microsoft-IIS/6.0
Any ideas what might be causing this?
php getcwd() returns wrong directory
Moderator: General Moderators
Re: php getcwd() returns wrong directory
Is that script being included by files in either of those directories? chdir() will change the current directory as well.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: php getcwd() returns wrong directory
No it's just an index.php listing all the files in a folder in order for the visitors to download.
Today even though getcwd doesn't work correctly the script seems to work again. *sigh*
It's so weird, the client has more than 1 sites/domains all on the same server. I used a test.php with a getcwd() to test it out and in siteA I got http://www.siteB.com/guestbook which is totally wrong.
There are 3 reasons why this could not be that the script is wrong, it's because:
We used the exact same settings as the old server,
The script worked on the old server and also worked the first days on the new one fine.
Recently we had max connection errors for mysql even though we had set the limit to unlimited and on the older server worked fine which is fishy.
On my server ( Linux ) the function getcwd always returns,
/home/www/mydomain.com or when the script is in a subfolder /home/www/mydomain.com/thesubfolder
Today even though getcwd doesn't work correctly the script seems to work again. *sigh*
It's so weird, the client has more than 1 sites/domains all on the same server. I used a test.php with a getcwd() to test it out and in siteA I got http://www.siteB.com/guestbook which is totally wrong.
There are 3 reasons why this could not be that the script is wrong, it's because:
We used the exact same settings as the old server,
The script worked on the old server and also worked the first days on the new one fine.
Recently we had max connection errors for mysql even though we had set the limit to unlimited and on the older server worked fine which is fishy.
On my server ( Linux ) the function getcwd always returns,
/home/www/mydomain.com or when the script is in a subfolder /home/www/mydomain.com/thesubfolder
Re: php getcwd() returns wrong directory
When all else fails, reboot.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: php getcwd() returns wrong directory
haha, tried numerous times.
Finally it was fixed. It seems it was a problem from the high security settings the ISP had given to the root directories of the domains.
Finally it was fixed. It seems it was a problem from the high security settings the ISP had given to the root directories of the domains.