1、安裝依賴的包
yum install php-devel gcc make autoconf
2、安裝re2c-0.16
這里需要注意 re2c的版本> = 0.13.6,centos6自帶的為0.13.5,需要手動編譯安裝
wget https://sourceforge.net/projects/re2c/files/0.16/re2c-0.16.tar.gz
tar zxf re2c-0.16.tar.gz && cd re2c-0.16
./configure
make && make install
ln -s /usr/local/bin/re2c /usr/bin/re2c
re2c --version #查看是否是0.16版本
注意這里安裝的時候可能報錯,有些主機安裝不了,可以在別的機器上安裝好后將/usr/local/bin/re2c文件拷貝到安裝不了的主機的/usr/bin目錄下
3、安裝php-zephir-parser
git clone git://github.com/phalcon/php-zephir-parser.git
cd php-zephir-parser
./install
4、將擴展名添加到您的php.ini中
[Zephir Parser]
extension = zephir_parser.so
service php-fpm restart
5、編寫phpinfo進行測試
編輯nginx的配置文件
vim server.conf
server {
listen 80;
server_name haha.xxx.com;
root /data/wwwroot/test-com;
location ~ .*\.(php|php5)?$ {
fastcgi_pass fastcgi_server;
fastcgi_index index.php;
include /nfs/local/openresty/nginx/conf/common/setting/fastcgi.conf;
}
}
在網站的根目錄下編輯index.php
vim index.php
<?php #如果php.ini文件中short_open_tag = Off此行關閉,表示關閉短格式,這里要加上php,不然可以不加
phpinfo();
?>
6、訪問網站
出現phpinfo的信息,信息中包含如下說明安裝成功
image.png
參考:https://blog.csdn.net/a454213722/article/details/51866100
https://github.com/phalcon/php-zephir-parser/tree/development