How to execute a perl script within php and capture error messages?

Posted by Marcel Tjandraatmadja on Stack Overflow See other posts from Stack Overflow or by Marcel Tjandraatmadja
Published on 2010-04-21T03:52:46Z Indexed on 2010/04/21 4:53 UTC
Read the original article Hit count: 251

Filed under:
|
|

I am trying to execute a Perl script like so:

/usr/bin/ec2-consistent-snapshot 'vol-dr3131c2'

When the Perl script fails it exits using 'die' and prints out an error message. I can see that error message when executing manually, but I am failing to capture it through PHP.

I tried the following with no success:

exec($command,$output);
echo system($command,$output);
passthru($command);

Any ideas?

© Stack Overflow or respective owner

Related posts about php

Related posts about perl