About PHP cannot use imagepng function, cause nginx 502 problem
Some of the wrong understandings:
1. libpng version low, this is not, and the version is not related
First of all to check yourself, phpinfo () there is a GD library support, if you have to see Phpinfo ()--with-png-dir=/usr/local/libpng.1.6.19, and then look at the PHP dependency library, with this:
ldd/usr/local/php/bin/php | grep libpng
What I see is this:
libpng12.so.0 =/usr/lib/x86_64-linux-gnu/libpng12.so.0 (0x00007fa6dbbe2000)
libpng12.so.0, in fact, is that the libpng version is 1.2.x.
Obviously libpng.1.6.19 and libpng.1.2.x are not right, the problem is here, the solution is:
1. Upgrade the LIBPNG12 version of/usr/lib/x86_64-linux-gnu/libpng12.so.0 to Libpng16, install-y Libpng16-dev with Apt-get, and recompile PHP.
2. The original/usr/local/libpng.1.6.19 deleted, recompile installation libpng, to use 1.2.x version, here will not repeat libpng installation, the path will be written to--with-png-dir= can be, and then recompile PHP.
Resources:
https://www.huangdc.com/533
PHP imagepng Function issues