Libpng version problem caused by PHP call GD extension Error solution

Source: Internet
Author: User
Tags php compiler
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.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.