Run Bash Command from PHP
You probably need to chdir to the correct directory before calling the script. This way you can ensure what directory your script is “in” before calling the shell command. $old_path = getcwd(); chdir(‘/my/path/’); $output = shell_exec(‘./script.sh var1 var2’); chdir($old_path);