Hello,
I've been at this for awhile now. The page executes a shellscript (.sh) file in the user's personal folder. The shellscript, when executed from the commandline works fine and exits fine (giving me commandline back).
When opening the php page, that has the system() command in it, php will execute the shellscript (and the shellscript actually does get executed) but php hangs and refuses to display a page.
I have tried many variations..here are some examples:
$last_line = system("nohup ".$target."/start.sh > /dev/null 2>&1 &");
$last_line = system($target."/start.sh &");
I have even tried substituting system() with exec().
What am I doing wrong? Also after php hangs, I get this in ps aux:
testuser 24229 0.0 0.0 0 0 ? Z 02:27 0:00 [sh <defunct>]
the 'sh' would be due to the shellscript. I am 100% sure the shellscript is okay. If I try to run the executable directly (instead of start.sh) using system(), then the executable filename will be the defunct instead of sh.
I would be very grateful for your help on this. I have read php.net manuals and tried many things.. I have exhausted my resources :\
it might be interesting to note that this one doesnt hang:
$last_line = exec($target."/mainfile stop &"); // stops the program
Thank you kindly,
-Ji