Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to execute /home/scripts/test.sh file in php

Previously i have placed 'test.sh' file in the /usr/bin and calling in my php file like this

exec('test.sh ' . escapeshellarg($testString)); 

But for security reasons i moved .sh file to /home/scripts directory and in my php i am calling like this

exec('/home/scripts/test.sh ' . escapeshellarg($testString)); 

But it is not working now.

Please suggest me how to achieve this.

share|improve this question
    
What are the permissions on the /home/scripts dir, the shell script, and what user:group is running php? – Paul Jun 26 '12 at 8:45
up vote 1 down vote accepted

Check the value of return_var and display the value of output - this will probably tell you that you have the wrong permissions set on either /home, /home/scripts or on /home/scripts/test.sh.

share|improve this answer
    
i forgot about giving permission to that file just i copied from local system to there, after giving execute permissions it worked. Thanks a lot.... – vvr Jun 27 '12 at 5:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .