1 安装依赖库
yum install -y autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel
2 下载源码
https://www.php.net/releases/
如果你访问很慢,可以访问我分享的网盘提取 链接:https://pan.baidu.com/s/1C0kf_i7ObTXUAgWUu0piiw 密码:m526
3 安装
下载后解压源码,进入目录,执行如下命令安装。
./configure --prefix=/usr/local/webserver/php/ --localstatedir=/usr/local/var --sysconfdir=/usr/local/webserver/php/ --with-config-file-path=/usr/local/webserver/php/ --with-config-file-scan-dir=/usr/local/webserver/php/ --with-pear=/usr/local/webserver/php/pear --enable-bcmath --enable-calendar --enable-dba --enable-exif --enable-ftp --enable-fpm --enable-intl --enable-mbregex --enable-mbstring --enable-mysqlnd --enable-pcntl --enable-phpdbg --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-zip --with-curl --with-fpm-user=_www --with-fpm-group=_www --with-freetype-dir=/usr/local/webserver/freetype --with-gd --with-gettext=/usr/local/webserver/gettext --with-jpeg-dir=/usr/local/webserver/jpeg --with-mcrypt --with-mhash --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-openssl --with-pdo-mysql=mysqlnd --with-pic --with-png-dir=/usr/local/webserver/libpng --with-xmlrpc
4 安装扩展
根据自己的项目需要 安装phpredis等扩展。