[PHP] 编译构建最新版PHP源码

时间:2022-01-09 05:47:40

获取最新PHP代码
git clone https://git.php.net/repository/php-src.git
构建编译环境
apt-get install build-essential

编译:
./buildconf
报错autoconf not found,apt-get install autoconf
./configure --help
./configure --prefix=/tmp/ --disable-all //指定编译后的路径,关闭所有的扩展编译
报错configure: error: bison is required to build,==>apt-get install bison
报错configure: error: xml2-config not found.,==>apt-get install libxml2*

make
报错virtual memory exhausted: Cannot allocate memory,==>没有分配虚拟内存,swap
dd if=/dev/zero of=/swap bs=1024 count=1M
mkswap /swap
swapon /swap
echo "/swap swap swap sw 0 0" >> /etc/fstab

make install

[PHP] 编译构建最新版PHP源码