Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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/ file in php

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

exec(' ' . 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/ ' . 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/

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.