0

I am trying to run reindex in Magento 2.2 apache 2.4 PHP 7.1 Elastic Search installed v 6.4 Search Engine (Amasty ElasticSearch) Tested and Successful.

For this reindex catalogsearch_fulltext

php bin/magento indexer:reindex catalogsearch_fulltext running this again gives below error

Premature end of JPEG file in vendor/magento/framework/Image/Adapter/Gd2.php on line 65

  1. I checked the php.ini file being used for the magento site Configuration File (php.ini) Path /opt/cpanel/ea-php71/root/etc Loaded Configuration File /opt/cpanel/ea-php71/root/etc/php.inI

In researched this error and found other people were given this advice and it fixed the error

"You can the set default value of gd.jpeg_ignore_warning=1 in php.ini

OR

You can set it like this ini_set('gd.jpeg_ignore_warning', true); in your PHP script before calling imagecreatefromjpeg()

After implementing any of the above, GD Library will ignore the error where it use to fail and imagecreatefromjpeg() will return an image resource identifier.

Note: In PHP 7.1.0 the default value of gd.jpeg_ignore_warning has been changed from 0 to 1"

I uncommented the line in my php.ini file

FROM ;gd.jpeg_ignore_warning = 0

To gd.jpeg_ignore_warning = 1

Restarted Apache and Nginx

Tried to run the reindex again and the same error

  1. Our dedicated server has Multi Php I checked in CLI ssh and it showing the same php.ini is being used by the CLI

I then checked in my mydomain.com/php.info

gd.jpeg_ignore_warning 1 (local value) 1 (master value)

I noticed these are same settings as before I made any changes they were both set to 1 (in the php.ini file mentioned above path it was commented) so where can it be getting this setting from?

Please, can someone help me as I spent over a day looking for a fix on this.

Where else should I be checking or changing this so I can complete the reindex Thank You

0

Please check gd.ini file in mods-available dir

/etc/php/7.1/mods-available

If gd.ini not available then run below command

apt-get install php7.1-gd

will install GD for PHP 7.1

  • thanks but I can not find this directory mods-available where else can it be I can not even find /etc/php/ only place i can find any ref to php 7.1 is /opt/cpanel/ea-php71/root/etc – jt9489 Jul 18 at 13:32
  • i checked in WHM and Easy Apache I can see php71-php-gd is installed – jt9489 Jul 18 at 16:40
  • I found gd.ini here [Home]/opt/cpanel/ea-php71/root/etc/php.d it was like this ;Enable gd extension module extension=gd.so i tried to make it like this Enable gd extension module gd.jpeg_ignore_warning = 1 extension=gd.so but I still get the same error – jt9489 Jul 18 at 23:25
  • Did you try this: apt-get install php7.1-gd – Ravi Soni Jul 19 at 5:22
  • Yes tried this apt-get install php7.1-gd But CLI did not understand it - is it different for linux centos 7 - secondly as a workaround I went to the file Gd2.php and put @ at the start - which bypass it however after running i got another error Catalog Search indexer process unknown error: Notice: getimagesize(): Read error! in /home/redjohnco/public_html/vendor/magento/module-catalog/Model/Product/ Image.php on line 420 – jt9489 Jul 19 at 11:41

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.