下载源码
安装依赖
编译
配置环境变量
1.下载源码
cd /usr/src
wget http://php.net/distributions/php-7.4.0.tar.gz
tar -zxvf php-7.4.0.tar.gz
cd php-7.4.0
2.安装依赖
yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel libzip-devel
3.编译
./configure --prefix=/php/php7.4 --with-config-file-path=/etc --with-fpm-user=www --with-fpm-group=www --with-curl --enable-gd --enable-mbstring --with-openssl --with-zip --with-zlib --with-pdo-mysql --enable-fpm
4.配置环境
#配置环境变量
vim /etc/profile
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
export PATH=$PATH:/php/php7.4/bin/
source /etc/profile
#准备配置文件
2.准备配置文件
cp php.ini-production /etc/php.ini
cp /php/php7.4/etc/php-fpm.conf.default /php/php7.4/etc/php-fpm.conf
cp /php/php7.4/etc/php-fpm.d/www.conf.default /php/php7.4/etc/php-fpm.d/www.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
service php-fpm start