PHP

PHP5.4.45编译安装报错

编译PHP的时候,具体报错信息如下:

-5.4.45/ext/sqlite3/libsqlite -I/data/app/snmp/include -I/usr/include/libxml2 -I/data/php-5.4.45/TSRM -I/data/php-5.4.45/Zend    -I/usr/include -g -O2 -fvisibility=hidden  -c /data/php-5.4.45/ext/gd/gd.c -o ext/gd/gd.lo
In file included from /data/php-5.4.45/ext/gd/gd.c:103:0:
/data/php-5.4.45/ext/gd/gd_ctx.c: 在函数‘_php_image_stream_putc’中:
/data/php-5.4.45/ext/gd/gd_ctx.c:51:41: 错误:‘struct gdIOCtx’没有名为‘data’的成员
php_stream * stream = (php_stream *)ctx->data;
^
/data/php-5.4.45/ext/gd/gd_ctx.c: 在函数‘_php_image_stream_putbuf’中:
/data/php-5.4.45/ext/gd/gd_ctx.c:58:41: 错误:‘struct gdIOCtx’没有名为‘data’的成员
php_stream * stream = (php_stream *)ctx->data;
^
/data/php-5.4.45/ext/gd/gd_ctx.c: 在函数‘_php_image_stream_ctxfree’中:
/data/php-5.4.45/ext/gd/gd_ctx.c:67:8: 错误:‘struct gdIOCtx’没有名为‘data’的成员
if(ctx->data) {
^
In file included from /data/php-5.4.45/main/php.h:396:0,
from /data/php-5.4.45/ext/gd/gd.c:32:
/data/php-5.4.45/ext/gd/gd_ctx.c:68:38: 错误:‘struct gdIOCtx’没有名为‘data’的成员
php_stream_close((php_stream *) ctx->data);
^
/data/php-5.4.45/main/php_streams.h:287:52: 附注:in definition of macro ‘php_stream_close’
#define php_stream_close(stream) _php_stream_free((stream), PHP_STREAM_FREE_CLOSE TSRMLS_CC)
^
In file included from /data/php-5.4.45/ext/gd/gd.c:103:0:
/data/php-5.4.45/ext/gd/gd_ctx.c:69:6: 错误:‘struct gdIOCtx’没有名为‘data’的成员
ctx->data = NULL;
^
In file included from /data/php-5.4.45/ext/gd/gd.c:103:0:
/data/php-5.4.45/ext/gd/gd_ctx.c: 在函数‘_php_image_output_ctx’中:
/data/php-5.4.45/ext/gd/gd_ctx.c:158:6: 错误:‘gdIOCtx’没有名为‘data’的成员
ctx->data = (void *)stream;
^
make: *** [ext/gd/gd.lo] 错误 1

如上看的话,大概是因为php的gd模块有问题,但是不知道如何解决,不知道谁可以帮忙看看,给点建议。

已邀请:

空心菜 - 心向阳光,茁壮成长

赞同来自: chris

解决办法,在你的gd模块安装目录,编辑vim gd/include/gd_io.h, 然后找到函数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);

/* seek must return 1 on SUCCESS, 0 on FAILURE. Unlike fseek! */
int (*seek) (struct gdIOCtx *, const int);

long (*tell) (struct gdIOCtx *);

void (*gd_free) (struct gdIOCtx *);
void (*data); /* 添加的行 */

}

然后你再次重新编译试试,应该是可以解决的,这个问题应该是PHP5.4.45的一个Bug。

要回复问题请先登录注册