ubuntu 编译php随笔

1. 安装git

sudo apt install git


2. 通过git获取php源码

git clone https://git.php.net/repository/php-src.git

3. 进入php-src/ 准备编译

cd php-src/

./buildconf

运行提示需要 autoconf 。

4. 安装 autoconf

sudo apt-get install autoconf


5. 重新进行php编译

由于只是做测试,所以编译一个最简最的php。

./configure --disable-all

此处遇到一个错误

configure: error: bison is required to build PHP/Zend when building a GIT checkout!

安装 bison

 sudo apt-get install bison

重新运行 ./configure --disable-all 一次性通过。

接下来可以make了

make

因为只是研究用,所以就不 make install 了。

make 后在sapi/cli里就有了php的可执行文件,可以执行下看看

./sapi/cli/php -v

posted @ 2016-09-01 10:09  junlyde  阅读(267)  评论(0编辑  收藏  举报