Hi I'm trying executing a bash script through PHP, when the script runs the shell interface appears for a few seconds and then disappears.
However what I need is a way to run the bash script without the shell appearing at all. Found the execInBackground function on the php website shown below but it isn't working for me. What would be the best way to do this?
function convert($tmpName, $fileName, $fileSize, $fileType){
$old_path = getcwd();
chdir('C:\xampp\htdocs\p-master\tools');
execInBackground("test.sh");
chdir($old_path);
}
function execInBackground($cmd) {
if (substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start /B ". $cmd, "r"));
}
else {
exec($cmd . " > /dev/null &");
}
}
Edit: The shell window that appears is Git Bash
Edit 2: Still having this problem, tried all the suggested solutions and tried different ones from around the web but no luck, can anyone help with this?