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
parser.plreturn 2? Are you sure you're running the script with the correct arguments? Is there anything in$output? And your example is missing an end double quote.exit(0);, for example)? That will let you know if it's something in your Perl script, or if its that you're not able to execute Perl at all.