Click to See Complete Forum and Search --> : Program Execution Problems


jaemark
09-08-2002, 09:26 AM
I'm having trouble with executing external programs from my PHP scripts when called from the browser. I've tried using system(), exec(), shell_exec(), and backticks.

I'm beginning to suspect that this has something to do with the mod_php module, because when I run the scripts from the command line using the PHP interpreter, they execute correctly. Problems come up when I run the same scripts from the browser.

Also, running simple commands such as "ls -l" work from the browser, but more complex applications (like, say, fortune or kwrite) don't. These same scripts work with the PHP interpreter.

I was wondering if this is an issue with the module, because the programs I run don't need to access data files so I don't think this is an ownership/access problem.

Thanks in advance for the help.

tasistro
09-10-2002, 06:43 PM
Ive uses backtics to do what you want

$command="lynx %whatever url here%";
$output=`$command`;

I works fine with complex TEXT only programs.

As for kwriter and the sort I think you need to have permision to access an Xsever which apache probably does not. I'm guessing this because apache doesn't even have an account directory so there is no way to save settings on $HOME. The reason it works when you run them from the interpreter is that the interpreter is running with you permissions and so is the script.

Saludos
Gerardo