Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.