How to execute shell script files from PHP or HTML. The sh file is located outside the localhost directory, and there are many other sh files which are initiated by the first sh file.
say the local host directory is
/opt/lampp/htdocs/xampp/test
and the location of the sh file is /home/user/scripts/run.sh.
run.sh copies some files uploaded from /opt/lampp/htdocs/xampp/test/upload to /home/user/scripts/file and execute some other .sh files.
I have tried many PHP methods with no success like
<?php $output = shell_exec('sh /home/user/script/run.sh'); echo "$output"; ?>
and
<?php
shell_exec("/home/user/server/run.sh");
?>
but no luck. I could not put the sh file in CGI directory as it is dependent on other script and files. How do I run the script from the directory it currently presents.