Page 1 of 1

Executing linux commands in a different directory

Posted: Fri Feb 02, 2007 12:52 am
by indika
:roll: Ok I'll give you the problem straight. I want to move to seperat directory from which I'm working and then issue commands.

Assume I need to move to root and then issue the command 'pwd'.

I tried

system("cd /");
system("pwd");

this gives me only the path which I work. Not the root.

Please help 8O , I'm new to PHP but not to programming. I'd appreciate if anybody can give me example codes

Thanks

Posted: Fri Feb 02, 2007 4:52 am
by impulse()
Try:

Code: Select all

system("cd /; pwd");