ExifTool Forum

ExifTool => Archives => Topic started by: Archive on May 12, 2010, 08:54:43 AM

Title: Using the command-line app with PHP?
Post by: Archive on May 12, 2010, 08:54:43 AM
[Originally posted by argehl on 2010-01-01 19:56:43-08]

What is the proper way of using the command-line app for ExifTool with PHP? I'm using the following codes but I'm really not sure how it can be done:

<?php
$var = shell_exec("perl exiftool t/images/image.jpg"");
echo '<pre>'.print_r($var).'</pre>';
echo $var;
if( !isset($var) ) die("dead");
?>

It's not working. All I'm getting is '1' as output followed by 'dead'. ExifTool itself doesn't seem to be working (crashing?). I'm using XAMPP in an Windows environment. The interpreter (perl.exe) is pasted in the same folder as the rest of the files.
Title: Re: Using the command-line app with PHP?
Post by: Archive on May 12, 2010, 08:54:43 AM
[Originally posted by exiftool on 2010-01-02 00:03:42-08]

It looks like $var should return the exit code of exiftool,
which should be 0 on success, or non-zero on failure.
I'm not sure why it doesn't seem to be running, but
to get the exiftool output you will need to capture the
console output (stdout) from the command.  I'm not sure
how to do this in PHP.  This output may give some clue
as to why it is returning an error code.

- Phil
Title: Re: Using the command-line app with PHP?
Post by: Archive on May 12, 2010, 08:54:43 AM
[Originally posted by argehl on 2010-01-02 12:30:36-08]

Thanks, the problem was with the perl installation. All fixed now Smiley