安装依赖&&下载源码并安装
yum update -y
yum install -y gcc gcc-c++
rpm -qa|grep libxml2
yum install -y libxml2-devel
yum install -y openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libxslt-devel libzip libzip-devel
yum install bzip2 bzip2-devel -y
https://www.php.net/downloads.php
wget https://www.php.net/distributions/php-7.3.11.tar.gz
./configure --prefix=/usr/local/php --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-fpm
make -j2
sudo make install
配置php和php-fpm
1、先把源码包里的php.ini-development文件cp(复制)到php设置目录下改名为php.ini
由于我编译参数没有设置 参数:–with-config-file-path=php.ini目录
默认在:安装目录/lib/php.ini
2、到php目录的etc中:
[root@wf etc]# cp php-fpm.conf.default php-fpm.conf
[root@wf etc]# cp php-fpm.d/www.conf.default php-fpm.d/www.conf
3.vim /etc/profile 追加两行
export PATH=/usr/local/php/bin:$PATH
export PATH=/usr/local/php/sbin:$PATH
source /etc/profile
php-fpm -v
php -v
可能遇到的问题
configue时遇到:
configure: error: Please reinstall the BZip2 distribution:
yum install bzip2 bzip2-devel -y