NLK511
(Pietrosottile)
November 13, 2012, 10:36am
1
I’m developing a web application that has to run some bash scripts. I tried to use shell_exec,exec and system function but i always obtain an error page.
the line of code that generate the error is this
system("scripts/1-All-Interactors.bash $Protein");
i’ve already tried to set permission of www-data but nothing is changed.
any idea?
thanks in advance
Keith
(Kburton)
November 13, 2012, 10:40am
2
What’s the error that you’re getting? It’s likely that PHP is running in a protected mode that is preventing you from executing system code.
NLK511
(Pietrosottile)
November 13, 2012, 10:57am
3
I get the same page you get when a server is down. PHP has safe mode off, is protected mode the same thing?
Keith
(Kburton)
November 13, 2012, 11:04am
4
Try with exec, but start with a basic system call to ensure that exec can be successfully run. Try the following from PHP’s docs:
exec('whoami');
Also make sure you turn on all error reporting for the purposes of debugging this.