安装php7.3.5/ 7.4.21 笔记及出坑指南

今天安装了php7.3.5 记录一下安装笔记,及碰到的坑。

1.首先安装yum源:

yum install epel-release

2.安装环境包:

yum install unzip libxml2 libxml2-devel freetype freetype-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel rsync openssl openssl-devel libmcrypt libmcrypt-devel autoconf libtool

3.安装cmake.(php7.3.5需要安装libzip,而libzip需要新版本的cmake)

cd ~ && yum remove cmake -y
wget https://github.com/Kitware/CMake/releases/download/v3.14.3/cmake-3.14.3.tar.gz
tar xvf cmake-3.14.3.tar.gz && cd cmake-3.14.3/
./bootstrap
gmake && gmake install
ln -s /usr/local/bin/cmake /usr/bin/
cmake --version

4.安装libzip

wget https://libzip.org/download/libzip-1.5.2.tar.gz
tar xvf libzip-1.5.2.tar.gz 
cd libzip-1.5.2 
mkdir build && cd build && cmake ..
make && make install

5.下载php7.3.5

在官网下载的话,速度贼慢。国内源也找不到了,貌似只有一个源了。最后去github上找到项目地址,下载release版本。秒下。

wget https://github.com/php/php-src/archive/php-7.3.5.tar.gz

6.安装php

先生成配置文件,新版本中不用autoconf了。方法如下:

./buildconf --force

安装开始:

./configure --prefix=/usr/local/php7.3 --with-curl=/usr/lib --with-mysqli --with-pdo-mysql --enable-fpm --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-gd --with-libxml-dir --enable-xml --disable-debug --enable-mbstring --enable-soap --enable-sockets --enable-zip --with-config-file-path=/usr/local/php7.3/etc --with-config-file-scan-dir=/usr/local/php7.3/etc/conf.d --with-libdir=lib64 --with-openssl

补充php7.4.21的安装命令(php7.4之后所支持扩展的命令有调整,已经全调过,并带上常用的扩展)

./configure --prefix=/usr/local/php7.4 --with-curl=/usr/lib --with-mysqli --with-pdo-mysql --enable-fpm --enable-gd --with-freetype --with-jpeg --with-zlib --enable-xml --disable-debug --enable-mbstring --enable-soap --enable-sockets --with-config-file-path=/usr/local/php7.4/etc --with-config-file-scan-dir=/usr/local/php7.4/etc/conf.d --with-libdir=lib64 --with-openssl

 

出现错误

checking for bison version... invalid
configure: WARNING: This bison version is not supported for regeneration of the Zend/PHP parsers (found: none, min: 204, excluded: ).
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
configure: error: bison is required to build PHP/Zend when building a GIT checkout!

解决方法:安装bison

yum install bison

安装完成后,返回上一步。顺利编译。

接着make

make && make install

至此,大功告成!

 

posted on 2019-05-09 09:09  laputa~  阅读(491)  评论(0编辑  收藏  举报

导航