-2

I am trying to run a perl script from php that requires parameters to be passed to the perl script to run correctly. The following is the correct usage of the perl script from the linux terminal:

/home/user/test.pl -a alpha -b beta

or just

/home/user/test.pl -a alpha

I have execute permissions on the script and can run it without any parameters and the correct usage from the script is displayed back to my browser.

Below is the PHP code that works by displaying the usage back to my browser:

$result = shell_exec('/home/user/test.pl');
echo $result;

And the following is the problem code which I can not for the life of me figure out:

$test = $_POST['test'];
$result = shell_exec('/home/user/test.pl -a'.' '.$test);
echo $result;

Can anyone tell me what it is that I am missing to make this work correctly?

Thank you for the help.

1 Answers1

0

My issue resided within the perl script itself and a specific line that was trying to output to a log file which the apache user did not have access to. I was calling the script correctly the whole time but once I was able to get to the server side logs (granted by system admin) I saw the issue was buried within the Perl script and not in php.