版本号:php-5.3.25

源码解压路径:/usr/local/src/php-5.3.25

configure能正常通过,但是在make的时候提示:

/usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c:4:18: error: png.h: No such file or directory

/usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c:8:22: error: jpeglib.h: No such file or directory

/usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c: In function 'gdJpegGetVersionInt':

/usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c:14: error: 'JPEG_LIB_VERSION' undeclared (first use in this function)

/usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c:14: error: (Each undeclared identifier is reported only once

/usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c:14: error: for each function it appears in.)

/usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c: In function 'gdJpegGetVersionString':

/usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c:19: error: 'JPEG_LIB_VERSION' undeclared (first use in this function)

/usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c: In function 'gdPngGetVersionString':

/usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c:32: error: 'PNG_LIBPNG_VER_STRING' undeclared (first use in this function)

make: *** [ext/gd/libgd/gd_compat.lo] Error 1

解决办法:

vi /usr/local/src/php-5.3.25/ext/gd/libgd/gd_compat.c

把下面2个值,修改为后面的

# include <png.h>    -->    # include </usr/local/libpng/include/png.h>

# include <jpeglib.h>    -->    # include </usr/local/jpeg/include/jpeglib.h>      

然后make clean

重新configure  、make 、make install 就可以了。