call perl script from within a php script

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi There,

I want to call a perl script from within a php script. I have tried
system() and exec() commands but i'm never getting any output. The
script works fine on the shell tho... :(
What I've tried:

echo '<pre>';

// Outputs all the result of shellcommand "ls", and returns
// the last output line into $last_line. Stores the return value
// of the shell command in $retval.
//$last_line = system('ls -la'/*'./'*/, $retval);
$last_line = exec(, $retval);

echo "len: " . strlen($last_line) . "<BR>";

print "<PRE>";var_dump($retval);print"</PRE>";

// Printing additional info
echo '
<hr />Last line of the output: ' . $last_line . '
<hr />Return value: ' . $retval;
print "<br><br>";
$output = shell_exec("./");
echo $output;
But I don't get anything back... why not? What am i missing? :o

Thanks for help!!!

Re: call perl script from within a php script

So okay, I think I figured it out myself, retrying shell_exec()
finally worked for me when printing characters to stdout instead of to

Quoted text here. Click to load it

Site Timeline