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
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.
You probably need to specify the full path to your perl executable.
which perl to see what the full path is, then place that full path in your
Your example seems to be missing the end quote for the first argument. I would also make sure that the executable for perl is in your path. Lastly, not only does the folder need to have the execute bit set, but all of the directories up to root need to be set to allow perl to access the script. It is fairly common for a directory to be 750 such that a group can get in, but not the world. As a user you may be able to cd there and see the script, but you must look at it from the perspective of the users that is executing the script -- presumably the id your webserver is running as.