PHP编译扩展时解析器出错

来源:互联网 发布:php 跨域 编辑:程序博客网 时间:2024/04/30 02:46
编译php扩展时出错,步骤如下:1 cd path/to/php-src/ext2 ./ext_skel --extname=example3 cd ..4 ./buildconf5 ./configure --with-example5 makeok,就在编译的时候解析器报错:path/to/php-src/Zend/zend_language_parser.y:50.1-5: invalid directive: `%code'path/to/php-src/Zend/zend_language_parser.y:50.7-14: syntax error, unexpected "identifier"

原因是%code是bison2.3+之后才引入的,我的机器上bison版本是1.875c,因此不支持,解决方法是:

1 下载高版本的bison并安装 

2 或者修改path/to/php-src/Zend/zend_language_parser.y,由于我没有root权限,bison是安装在/usr/bin/bison的,因此采用方案2,具体如下:

将%code requires { 修改为%{将} 修改为%}make cleanmake

Ok.
0 0
原创粉丝点击