We have a server located at a local company's place of business running Solaris/Apache/PHP. They recently did an update to Solaris, Apache, and PHP (security update patches, etc.). Unfortunately it has caused the image manipulation portion of our software to break. imagecreatefromjpeg() is now generating the following error:

Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: '/path/to/file/filename.jpg' is not a valid JPEG file in /path/to/file/Image.class.php on line XX

No PHP code was changed during the server upgrade and it was fully functional before the software upgrades. I checked the files being passed to imagecreatefromjpeg() and they are indeed valid (they open successfully in both image editing software and in my browser). I checked the permissions of the directory from which the files are being opened and they do have read permission. GD library is enabled.

I'm not sure what else I can check. Based on the scenario above I am guessing something changed in the software but I don't know what it could be. PHP was version 5.2.5 and is now 5.2.13.

I appreciate any guidance as to what could be cause of this issue.



  • php.ini was replaced, changed, or isn't being read. Compare backup to current one on system.
  • New package is compiled with different options. Compare new and old by running php -i

I know it seems unrelated, but verifying fundamentals such as permissions and resource availability (memory) could potentially help isolate the issue as well.

Are there any other errors?

  • php.ini files are identical. Comparing phpinfo() shows no difference in anything related to the GD library or images in general. Per missions are unchanged (and correct) and resources do not appear to be an issue (but still checking to be sure). – John Conde Jun 15 '10 at 13:24

Apparently the newer jpeg libraries were not compatible with something else in the system. Once we switched back to the old jpeg libraries it started working again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.