narengr Posted February 13, 2008 Share Posted February 13, 2008 Hi friends... Below is the code. When i try to execute this i am getting the error produced by die; "could not run the program"; <html> <body> <?php $val = shell_exec ( 'RepeatMasker temp/gene.txt > b.out' ) || die("could not run the program"); echo "<pre>$val</pre>"; ?> </body> </html> RepeatMasker is a computational program which takes an argument. The program runs and produces output when i run in terminal. But program cannot be invoked when i am using it with CGI-PERL or PHP. I am suspecting that Apache server loses its privileges when it goes to the background. Please help me with the same. thanks in advance. Naren Quote Link to comment https://forums.phpfreaks.com/topic/90894-php-dies-when-executing-a-shell-command/ Share on other sites More sharing options...
trq Posted February 13, 2008 Share Posted February 13, 2008 Your sending the output to a file, nothing will ever show up in $var. Quote Link to comment https://forums.phpfreaks.com/topic/90894-php-dies-when-executing-a-shell-command/#findComment-465817 Share on other sites More sharing options...
narengr Posted February 14, 2008 Author Share Posted February 14, 2008 $var = shell_exec ( 'RepeatMasker temp/gene.txt ' ) || die("could not run the program"); I have changed the code as above still its dying, in a browser. Quote Link to comment https://forums.phpfreaks.com/topic/90894-php-dies-when-executing-a-shell-command/#findComment-466556 Share on other sites More sharing options...
Daniel0 Posted February 14, 2008 Share Posted February 14, 2008 You need to write or (with letters) and not use the logical "or" operator. Quote Link to comment https://forums.phpfreaks.com/topic/90894-php-dies-when-executing-a-shell-command/#findComment-466737 Share on other sites More sharing options...
narengr Posted February 18, 2008 Author Share Posted February 18, 2008 <html> <title> RepeatMasker </title> <body> <?php $var = shell_exec ("RepeatMasker gene.txt") or die ("Could not run"); echo $var; ?> </body> </html> I have modified the code like the above. Programs dies saying could not run. Quote Link to comment https://forums.phpfreaks.com/topic/90894-php-dies-when-executing-a-shell-command/#findComment-469329 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.