Monday, November 22, 2010

Help me with the syntax of this PHP exec() function?

I want to run a shell script from PHP which is at some location on my server. Now first I ran the shell script directly from shell mode. I had to change directory to the location of the shell script. Now using PHP script if I run the following code:

=====================================

%26lt;?

exec('cd ..');



passthru('ls');



?%26gt;

===========================



The output shows the directories in the same directory and not one level up. That means I am not able to change directory using exec('cd ..'); function.



What is the error? How do I change directories. Please help

?%26gt;Help me with the syntax of this PHP exec() function?
You can use the chdir function which is built in



bool chdir ( string directory )



--------------------------------------?br>
chdir('../'); or chdir('target_directory_path');
  • punk hair
  • Fish
  • No comments:

    Post a Comment