Write a test of GD script test.php, and then execute at the command line, the error message is as follows:
PHP test.phplibpng Warning:application was compiled with png.h from Libpng-1.5.6libpng Warning:application is running WI Th png.c from Libpng-1.2.49libpng error:incompatible libpng version in application and Library[read_png_file] Png_create_ Read_struct failed
Very puzzled, in the compilation of GD, PHP, has specified the location of the PNG –with-png-dir=/usr/local/libpng, using the 1.5.6, why the implementation of the time will also call the libpng-1.2.49, so the system libpng-1.2.49 Delete (because it is the test environment, just delete, the online server self-weight), recompile PHP, I have a go, compile not past, hint: (Here is because GD has a call, resulting in PHP to compile the GD library when it is not found)
/usr/bin/ld:cannot Find-lpng12collect2:ld returned 1 exit statusmake: * * * [SAPI/FPM/PHP-FPM] Error 1
I wipe, the default will call the SYSTEM library!!! There are only 2 compile calls to PNG, one is the php compiler parameter –with-png-dir=/usr/local/libpng, the other is the GD library, and then recompile GD, at compile time found such a 2 line:
Originally in GD here, has already called the system libpng-1.2.49. Here by the way, Libpng12, LIBPNG15, LIBPNG16 number is the representative version number 1.2.X, 1.5.X, 1.6.X specific can see
ls/usr/include/libpng* know the problem, solve the problem is more targeted, 2 methods:
1, the system brought to the delete, this feel more unreliable, afraid of interdependence, there is a sequela is not good.
After the deletion, the compilation becomes:
Checking for libpng12-config ... nochecking for libpng-config .../usr/local/bin/libpng-config
2, two versions can be preserved, after compiling, modify the makefile file.
Modify the value of about 262 lines of libpng12_config, change to the same as libpng_config, such as:
Libpng12_config =/usr/bin/libpng12-configlibpng_config =/usr/local/bin/libpng-config
Modified into
Libpng12_config =/usr/local/bin/libpng-configlibpng_config =/usr/local/bin/libpng-config
Then the make && make install will be OK.