Chdir not doing anything

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Chdir not doing anything

Post by shiznatix »

I moved a website from the test server to the live server and now I have some problems.

The problem is that the chdir() command no longer works. I need to step down a dir but doing chdir('../') does nothing. When I var_dump() it, it return bool(false).

Safe mode is Off and im moving to the root directory so there should not be any permission problems. Any idea why this would happen?

Edit: also, the test server is on the same shared host as the live server so I don't see how there could be this strangeness since its the same server configuration.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Does the user that PHP runs under have permission to access (read and execute) that directory?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

Yes, the proper permissions are in place.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Does getcwd() tell you what you expect (before the call)?

What's important about changing the working directory to that one?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

ya getcwd() makes sence before the call but after the call to chdir() it keeps the same directory.

The thing is I am using a framework thingy that I made and all of the engine and everything are in the root directory. I put the regular index.php files in the root directory and they have access to everything no problem when I use require_once but I put the admin files in /admin and now for those files to use the requires that are built in I need to be in the root directory so I try to just do chdir('../') first thing to get to that dir which usually works perfectly fine but for some reason now I cant do it.

I put up some stupid small fix but its quite hackish and im not a fan.
Post Reply