tags:

views:

808

answers:

1

This is very stupid but I seem to be completely lost trying to test a Perl command-line application with XAMPP. I downloaded the 'ExifTool by Phil Harvey' and extracted the files in a folder within htdocs with an index.php in it, in which I hope to set up a PHP interface to the functionalities provided by ExifTool. Actually I can't even run a simple "Hello World" Perl script to run from a PHP script and handle the output. I tried using shell_exec but not sure if I'm putting the right commands in. (./exiftool t/images/ExifTool.jpg, but the output is nothing.)

[I'm trying to make a website where I can upload an image and have the exif info displayed with the help of ExifTool assuming ./exiftool -j t/images/ExifTool.jpg returns some nice JSON data. But I'm not sure how to get it to work to begin with :( Thanks.]

+3  A: 

You have to add the perl interpreter to the string you pass to shell_exec(), exiftool itself won't be run directly.

If you just need to work with Exif data, you can use PHP direct support: http://php.net/manual/en/book.exif.php

kemp
Tatu Ulmanen
Um, I'm sure the last P in XAMPP is for Perl and there's probably an interpreter in 'xampp\perl\bin'. I'd look into the PHP option, but I'm really hoping the ExifTool thing works because of the simple output format.
mathon12
Oh I'm sorry it's been a while since I wrote some code on windows. In any case maybe you should specify the perl interpreter when calling the script? Like `/path/to/binary/perl.exe /path/to/exiftool ...`
kemp
Hey, thanks! I just pasted the interpreter in the work folder and the 'Hello World` script seems to work just fine. ExifTool's still not working. I tried the following:`<?php$var = shell_exec("perl exiftool -j t/images/image.jpg");echo '<pre>'.print_r($var).'</pre>';?>`Just prints `1`. Not sure what's happening =/
mathon12
I don't know, try running it from the command line until you get the version of that command string that gives the desired output. The PHP part is ok.
kemp
Okay, thanks. The win32 standalone seems to work just fine with those commands sadly.
mathon12