I'm trying to execute a perl script from php.
That perl script is reading a webpage and producing an xml file with some data.
If i exec it via shell everything works as expected but when I'm trying to automate the whole thing via php nothing works.
I've tried this:
exec("perl /absolute/path/to/perl/script/parser.pl", $output, $result);
when i echo the $result
variable it displays 2
.
I've switched the php safe_mode On and Off several times but nothing changed.
Also tried to set the safe_mode_exec_dir
without positive results.
When i exec a simple ls
exec("ls", $output, $result);
everything goes well, i get the list of files and $result
is 0
.
The perl script has chmod 777 so that it would not be a problem of permission. Also his folder has 777.
I'm almost sure that the issue is something about the server but I'm not able to find out what.
Any help would be really appreciated.
Thanks
Best Answer
You probably need to specify the full path to your perl executable.
Try typing
which perl
to see what the full path is, then place that full path in yourexec
call.