centos7 安装php 5.x.x 报错

错误1:

/usr/src/php-5.2.9/ext/dom/node.c:In function 'dom_canonicalization':

/usr/src/php-5.2.9/ext/dom/node.c:1950:21: error: dereferencingpointer to incomplete type

    ret = buf->buffer->use;

                                 ^

Infile included from /usr/src/php-5.2.9/main/php.h:38:0,

                 from/usr/src/php-5.2.9/ext/dom/node.c:26:

/usr/src/php-5.2.9/ext/dom/node.c:1952:40: error:dereferencing pointer to incomplete type

     RETVAL_STRINGL((char *)buf->buffer->content, ret, 1);

                                        ^

/usr/src/php-5.2.9/Zend/zend_API.h:472:14:note: in definition of macro 'ZVAL_STRINGL'

   char *__s=(s); int __l=l;  \

              ^

/usr/src/php-5.2.9/ext/dom/node.c:1952:5:note: in expansion of macro 'RETVAL_STRINGL'

     RETVAL_STRINGL((char *)buf->buffer->content, ret, 1);

make:*** [ext/dom/node.lo] 错误1

[[email protected]]#

 

错误2:

/usr/src/php-5.2.9/ext/dom/documenttype.c:In function 'dom_documenttype_internal_subset_read':

/usr/src/php-5.2.9/ext/dom/documenttype.c:219:42: error:dereferencing pointer to incomplete type

    strintsubset =xmlStrndup(buff->buffer->content, buff->buffer->use);

                                 ^

/usr/src/php-5.2.9/ext/dom/documenttype.c:219:65: error:dereferencing pointer to incomplete type

    strintsubset =xmlStrndup(buff->buffer->content, buff->buffer->use);

                                ^

make:*** [ext/dom/documenttype.lo] 错误 1

[[email protected]]#

 

解决办法:

    下载https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt补丁程序

    编辑/usr/src/php-5.2.9/ext/dom/node.c文件,将源代码段替换为对应的补丁代码段(表紫色部分)

---ext/dom/node.c  2012-08-06 17:49:48.826716692+0800

+++ext/dom/node.c      2012-08-0617:52:47.633484660 +0800

@@-1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA

         RETVAL_FALSE;

     } else {

             if (mode == 0) {

#ifdef LIBXML2_NEW_BUFFER

            ret =xmlOutputBufferGetSize(buf);

#else

                    ret = buf->buffer->use;

#endif

                    if (ret > 0) {

#ifdef LIBXML2_NEW_BUFFER

               RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1);

+#else

                           RETVAL_STRINGL((char *) buf->buffer->content,ret, 1);

#endif

                    } else {

                           RETVAL_EMPTY_STRING();

                    }

3.同理编辑/usr/src/php-5.2.9/ext/dom/documenttype.c文件,将源代码段替换为对应的补丁代码段(表紫色部分)

---ext/dom/documenttype.c   2012-08-0618:02:16.019640870 +0800

+++ext/dom/documenttype.c       2012-08-06 18:06:16.612228905+0800

@@-205,7 +205,13 @@ int dom_documenttype_internal_subset_rea

             if (buff != NULL) {

                    xmlNodeDumpOutput (buff, NULL, (xmlNodePtr)intsubset, 0, 0, NULL);

                    xmlOutputBufferFlush(buff);

 

#ifdef LIBXML2_NEW_BUFFER

                     ZVAL_STRINGL(*retval,xmlOutputBufferGetContent(buff),

                                  xmlOutputBufferGetSize(buff), 1);

#else

                    ZVAL_STRINGL(*retval, buff->buffer->content,buff->buffer->use, 1);

#endif

                    (void)xmlOutputBufferClose(buff);

                    return SUCCESS;

             }

猜你喜欢

转载自www.cnblogs.com/handongyu/p/8991425.html