Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP-FPM error log says "Not a JPEG file: starts with 0x47 0x49"

Tags:

php

In my PHP-FPM log file I have lot's of rows like the following

[18-Sep-2016 03:59:06] WARNING: [pool www] child 5425 said into stderr: "Not a JPEG file: starts with 0x47 0x49"

What does it means?

like image 925
Andrea Avatar asked Sep 07 '25 09:09

Andrea


2 Answers

It is a common error. It looks like you are opening a file with imagecreatefromjpeg, but it is not a jpeg, it is a gif file, take a look at this note concerning starting bytes.

like image 102
shukshin.ivan Avatar answered Sep 10 '25 08:09

shukshin.ivan


It's most supposely a GIF, as they start with 0x47 0x49. JPG starts with 0xFF 0xD8 0xFF. Have a look at https://en.wikipedia.org/wiki/List_of_file_signatures and reconsider your code: do you want to fail it on such cases (filenames alone are never a guarantee for their content), or do you want to react on it by then guessing its format and trying to parse it as such.

like image 26
AmigoJack Avatar answered Sep 10 '25 10:09

AmigoJack