Search code examples
phpimagejpegexif

PHP's exif_read_data() function causes 500 server error


For some reason my production server is giving me a 500 server error when running the exif_read_data() function on a jpg image. I have verified that the image is indeed a jpg, exists, and has proper permissions. The function works perfectly on my localhost machine.

What could possibly cause this error?

The server is running PHP 5.3.17, my localhost is running 5.3.8, but I doubt that should make a difference.

Thank you.

EDIT: my simple code.

error_reporting(E_ALL);
$path = '/home/user/staging/files/image.jpg';
$exif = exif_read_data($path);
var_dump($exif);

Solution

  • For anyone wondering what the solution was, it was to recompile Apache with the exif module enabled. Apparently it's possible not to have it on by default.