Perl Code in PHP on a Tenon Server

Due to the fact that I get E-Mails asking how I did this or that picture, I wanted to share some EXIF-Information with the pictures shown in the blog. I ran across a neat plugin for WordPress called “Exifer“, which provides the most important information like shutter speed, aperture, ISO etc. To be honest I was just about ready to use this plugin when I noticed, that it couldn’t read out the ImageNumber-tag my D200 provides. For the sake of a transparent photo history I decided to look for a way to extract this information (as I am already doing in my gallery).


Unfortunately there was no PHP-based way to access all the EXIF-fields. I couldn’t believe it, but neither the exif_read_data – function nor the exif.php was anywhere near complete or up-to-date. So I had to look for another way to extract the EXIF-tags I wanted. Since I already wrote my own Perl-script (based on the Image::ExifTool module), it’s natural that I went looking for some way to use my Perl-Code in PHP.


The key to the solution was Zend Technologies Perl extension for PHP. Installation wasn’t as easy as I hoped. First I had to install autoconf for which I had to install m4. But while running the config for m4 I was kindly told that I don’t even have a C-compiler on my webserver. A quick 1GB X-Code download rectified that situation. Now that I meet the requirements for the perl-1.0.0 – extension I had to tackle another problem: where to install the extension to? Currently the webservice is running on the Tenon server package “iTools” which brings it’s own PHP-distibution. So I had to change the
  export PHP_PREFIX="/usr"
to something like
  export PHP_PREFIX="/Library/Tenon/PHP/".
I did the final step of the installation as described in the README and modified the appropriate php.ini accordingly. After all that hassle the extension worked perfectly … in the shell. I still got blank pages in the browser. It took a good nights rest to come up with the idea, that a server restart might to the trick, after which the examples given by Zend Technology worked flawlessly in the browser as well. Seems like, the Apache read the php.ini only once at startup.