Enabling PHP exif extension
by Sasa Bogdanovic ~ November 24th, 2008.
EXIF (Exchangeable image information) data provide digital image metadata. This information is stored in the header of the image in JPEG or TIFF format. It can be very detailed (even thumbnails can be embedded) and is included in the filesize of the image. In PHP web applications it is very easy to extract the available information, however, there are some prerequestes that need to be met.
Exif extension is a standard part of PHP distributions, but it must be enabled in php.ini file in order to use its functions. On windows, exif extension also depends on mbstring, an extension that provides multibyte string parsing. Moreover, the sequence of enabling extensions in php.ini file does matter. If exif is enabled prior to mbstring, exif functions will not be available at runtime.
If you need to use exif functions in your environment, be it development or production, this is something you need to keep in mind. By default, extensions are ordered in alphabetical order in php.ini file. This makes it very easy to run into situation when you start banging your head against the wall as you don’t realize why function_exists('exif_read_data') keeps returning false even though you have enabled both exif and mbstring extensions. Recently I needed a quick setup of development environment on my laptop and downloaded WAMP server, probably the most popular WAMP stack available, you will run into the same situation.
I find it really awkward. Including extensions in alphabetical order does not make any sense when there are depenencies like this.
Filed under: php.





