在centos6.5编译安装/升级到php 5.4.X时,configure能正常通过,但是在make的时候提示:
In file included from /root/php-5.4.5/ext/gd/libgd/gd_compat.c:8:
/usr/local/jpeg/include/jpeglib.h:938: error: expected declaration specifiers or ‘...’ before ‘FILE’
/usr/local/jpeg/include/jpeglib.h:939: error: expected declaration specifiers or ‘...’ before ‘FILE’
make: *** [ext/gd/libgd/gd_compat.lo] Error 1
修改php-5.4.5/ext/gd/libgd/gd_compat.c 把png.h 改成绝对路径(这个在编译gd库的时候应该就碰到了,同样的路径即可)
并在# include <jpeglib.h> 前面增加一行 #include <stdio.h>
修改后如下所示:
#include "php_config.h"
#ifdef HAVE_GD_PNG
/* needs to be first */
# include </usr/local/libpng/include/png.h> //修改此处
#endif
#ifdef HAVE_GD_JPG
#include <stdio.h> //修改此处
# include <jpeglib.h>
#endif
然后make clean
重新configure 、make 、make install 就可以了。
第二种情况:
configure能正常通过,make配置到最后报错:make: *** [ext/gd/gd.lo] Error 1
据说这个错误是php5.4的bug:
解决方法
vi /usr/local/gd2/include/gd_io.h //安装gd库的路径
gdIOCtx结构中增加void *data;
如下:
==========================================================
typedef struct gdIOCtx
{
int (*getC) (struct gdIOCtx *);
int (*getBuf) (struct gdIOCtx *, void *, int);
void (*putC) (struct gdIOCtx *, int);
int (*putBuf) (struct gdIOCtx *, const void *, int);
int (*seek) (struct gdIOCtx *, const int);
long (*tell) (struct gdIOCtx *);
void (*gd_free) (struct gdIOCtx *);
void (*data); //添加的内容
}
gdIOCtx;
==========================================================
重新编译前最好执行如下:
[root@localhost php-5.4.5]# make clean //清除make
重新configure 、make 、make install 就可以了。
In file included from /root/php-5.4.5/ext/gd/libgd/gd_compat.c:8:
/usr/local/jpeg/include/jpeglib.h:938: error: expected declaration specifiers or ‘...’ before ‘FILE’
/usr/local/jpeg/include/jpeglib.h:939: error: expected declaration specifiers or ‘...’ before ‘FILE’
make: *** [ext/gd/libgd/gd_compat.lo] Error 1
修改php-5.4.5/ext/gd/libgd/gd_compat.c 把png.h 改成绝对路径(这个在编译gd库的时候应该就碰到了,同样的路径即可)
并在# include <jpeglib.h> 前面增加一行 #include <stdio.h>
修改后如下所示:
#include "php_config.h"
#ifdef HAVE_GD_PNG
/* needs to be first */
# include </usr/local/libpng/include/png.h> //修改此处
#endif
#ifdef HAVE_GD_JPG
#include <stdio.h> //修改此处
# include <jpeglib.h>
#endif
然后make clean
重新configure 、make 、make install 就可以了。
第二种情况:
configure能正常通过,make配置到最后报错:make: *** [ext/gd/gd.lo] Error 1
据说这个错误是php5.4的bug:
解决方法
vi /usr/local/gd2/include/gd_io.h //安装gd库的路径
gdIOCtx结构中增加void *data;
如下:
==========================================================
typedef struct gdIOCtx
{
int (*getC) (struct gdIOCtx *);
int (*getBuf) (struct gdIOCtx *, void *, int);
void (*putC) (struct gdIOCtx *, int);
int (*putBuf) (struct gdIOCtx *, const void *, int);
int (*seek) (struct gdIOCtx *, const int);
long (*tell) (struct gdIOCtx *);
void (*gd_free) (struct gdIOCtx *);
void (*data); //添加的内容
}
gdIOCtx;
==========================================================
重新编译前最好执行如下:
[root@localhost php-5.4.5]# make clean //清除make
重新configure 、make 、make install 就可以了。