我正在用多个PHP版本的 (7和5.6)安装我的新笔记本,在编译PHP-7.0之后,我在PHP-5.6编译过程中得到了令牌程序错误。
步骤
sudo mkdir /opt/sourcecd /opt/sourcesudo git clone https://github.com/php/php-src.gitcd php-srcsudo git checkout PHP-5.6.17sudo ./configure --prefix=/opt/php-5.6 --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --with-fpm-user=nginx --with-fpm-group=nginx --with-libdir=/lib/x86_64-linux-gnu --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-gd --with-jpeg-dir=/usr/lib/ --enable-fpm误差
/bin/bash /opt/source/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/standard/ -I/opt/source/php-src/ext/standard/ -DPHP_ATOM_INC -I/opt/source/php-src/include -I/opt/source/php-src/main -I/opt/source/php-src -I/opt/source/php-src/ext/date/lib -I/opt/source/php-src/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/c-client -I/opt/source/php-src/ext/mbstring/oniguruma -I/opt/source/php-src/ext/mbstring/libmbfl -I/opt/source/php-src/ext/mbstring/libmbfl/mbfl -I/usr/include/postgresql -I/opt/source/php-src/ext/sqlite3/libsqlite -I/opt/source/php-src/ext/zip/lib -I/opt/source/php-src/TSRM -I/opt/source/php-src/Zend -I/usr/include -g -O2 -fvisibility=hidden -c /opt/source/php-src/ext/standard/info.c -o ext/standard/info.lo
/bin/bash /opt/source/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/tokenizer/ -I/opt/source/php-src/ext/tokenizer/ -DPHP_ATOM_INC -I/opt/source/php-src/include -I/opt/source/php-src/main -I/opt/source/php-src -I/opt/source/php-src/ext/date/lib -I/opt/source/php-src/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/c-client -I/opt/source/php-src/ext/mbstring/oniguruma -I/opt/source/php-src/ext/mbstring/libmbfl -I/opt/source/php-src/ext/mbstring/libmbfl/mbfl -I/usr/include/postgresql -I/opt/source/php-src/ext/sqlite3/libsqlite -I/opt/source/php-src/ext/zip/lib -I/opt/source/php-src/TSRM -I/opt/source/php-src/Zend -I/usr/include -g -O2 -fvisibility=hidden -c /opt/source/php-src/ext/tokenizer/tokenizer.c -o ext/tokenizer/tokenizer.lo
/bin/bash /opt/source/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/tokenizer/ -I/opt/source/php-src/ext/tokenizer/ -DPHP_ATOM_INC -I/opt/source/php-src/include -I/opt/source/php-src/main -I/opt/source/php-src -I/opt/source/php-src/ext/date/lib -I/opt/source/php-src/ext/ereg/regex -I/usr/include/libxml2 -I/usr/include/freetype2 -I/usr/include/c-client -I/opt/source/php-src/ext/mbstring/oniguruma -I/opt/source/php-src/ext/mbstring/libmbfl -I/opt/source/php-src/ext/mbstring/libmbfl/mbfl -I/usr/include/postgresql -I/opt/source/php-src/ext/sqlite3/libsqlite -I/opt/source/php-src/ext/zip/lib -I/opt/source/php-src/TSRM -I/opt/source/php-src/Zend -I/usr/include -g -O2 -fvisibility=hidden -c /opt/source/php-src/ext/tokenizer/tokenizer_data.c -o ext/tokenizer/tokenizer_data.lo
In file included from /opt/source/php-src/main/php.h:406:0,
from /opt/source/php-src/ext/tokenizer/tokenizer_data.c:26:
/opt/source/php-src/ext/tokenizer/tokenizer_data.c: In function ‘tokenizer_register_constants’:
/opt/source/php-src/ext/tokenizer/tokenizer_data.c:89:40: error: ‘T_CHARACTER’ undeclared (first use in this function)
REGISTER_LONG_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT);
^
/opt/source/php-src/Zend/zend_constants.h:43:103: note: in definition of macro ‘REGISTER_LONG_CONSTANT’
#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
^
/opt/source/php-src/ext/tokenizer/tokenizer_data.c:89:40: note: each undeclared identifier is reported only once for each function it appears in
REGISTER_LONG_CONSTANT("T_CHARACTER", T_CHARACTER, CONST_CS | CONST_PERSISTENT);
^
/opt/source/php-src/Zend/zend_constants.h:43:103: note: in definition of macro ‘REGISTER_LONG_CONSTANT’
#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
^
/opt/source/php-src/ext/tokenizer/tokenizer_data.c:90:44: error: ‘T_BAD_CHARACTER’ undeclared (first use in this function)
REGISTER_LONG_CONSTANT("T_BAD_CHARACTER", T_BAD_CHARACTER, CONST_CS | CONST_PERSISTENT);
^
/opt/source/php-src/Zend/zend_constants.h:43:103: note: in definition of macro ‘REGISTER_LONG_CONSTANT’
#define REGISTER_LONG_CONSTANT(name, lval, flags) zend_register_long_constant((name), sizeof(name), (lval), (flags), module_number TSRMLS_CC)
^
/opt/source/php-src/ext/tokenizer/tokenizer_data.c: In function ‘get_token_type_name’:
/opt/source/php-src/ext/tokenizer/tokenizer_data.c:228:8: error: ‘T_CHARACTER’ undeclared (first use in this function)
case T_CHARACTER: return "T_CHARACTER";
^
/opt/source/php-src/ext/tokenizer/tokenizer_data.c:229:8: error: ‘T_BAD_CHARACTER’ undeclared (first use in this function)
case T_BAD_CHARACTER: return "T_BAD_CHARACTER";
^
make: *** [ext/tokenizer/tokenizer_data.lo] Error 1
root@patrick:/opt/source/php-src# 设置
如果你需要更多的信息,请在投票前告诉我。
谢谢。
发布于 2017-06-21 18:15:14
我在Ubuntu 14上编译PHP时遇到了同样的错误,并决定继续编写更多的5.6.30。原来我使用的是一个不受支持的GNU Bison版本。Ubuntu14.04提供Bison版本的3.x.x。事实证明,PHP5只支持Bison2.4和更高版本(但不支持大于或等于3.x.x)。我还没有找到确切的消息来源来支持这一说法。然而,我相信,我的结论是合理的,根据试验和错误。
为了在Ubuntu14.04上编译PHP5.6,我从启动板下载了Bison2.5。找到您的机器的架构并下载相应的.deb存档。在某个目录下提取包的数据部分的内容,如下所示:
$ ar x bison_2.5.dfsg-2.1_ARCH.deb
$ tar xf data.tar.gz现在,您需要将配置脚本指向配置脚本,以便在Bison版本配置构建时使用它。为此,将PATH变量设置为自定义Bison二进制文件位置的第一点(注意:数据归档扩展到提取目录下的./usr/bin/bison ):
$ PATH=/path/to/extraction/usr/bin:$PATH ./configure ...您应该在输出中看到如下内容:
checking for bison... bison -y
checking for bison version... 2.5 (ok)现在试试make。如果结果和我的一样,它应该建好。
有趣的是,在使用Bison 3之前,我已经构建了PHP,它运行得很好。我倾向于认为这只是PHP 5构建的一个限制。
https://stackoverflow.com/questions/34435634
复制相似问题