Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getcwd not working

Status
Not open for further replies.

roycrom

Programmer
Joined
Aug 2, 2002
Messages
184
Location
GB
Hi all,

I've got a strange problem. I have a script that uses the getcwd() function. For some unknown reason it stopped working halfway through today. I am still investigationg this but in the mean time I replaced the following
Code:
$STARTINGDIR = getcwd();
with this
Code:
$STARTINGDIR = dirname(__FILE__);
Does anybody know what the difference would be between the content of these two variables? if any?

Thanks for any help you can give

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
Was there a change in the operating environment? Some update installed or a feature activated or a permission on something changed?

Bastien

Cat, the other other white meat
 
getcwd() can change depending on how the script is launched, or by use of the chdir() function.

dirname(__FILE__) is always going to tell you the location of the script in question.
 
Hi,

Thanks for your replies,

I had changed the group for the user which I think broke this so I restored it from the day before I changed it, this fixed the problem but I am still confused as to why this stopped working as the apache user still had permissions for the directories that the script was running from.

I am really having trouble getting things to work without breakiong other things but hey... back to pestering the boss for a test server. Not good changing things live but I have no choice at the moment.

Thanks again

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top