lnmp部署-编译安装PHP7.2

1)解压

tar -zxvf php-7.2.12.tar.gz

2)安装编译php需要的依赖包:

yum install gcc autoconf gcc-c++
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 readline readline-devel libxslt libxslt-devel
yum install systemd-devel
yum install openjpeg-devel

3)和nginx使用相同的用户,如果没有就创建

4)编译安装

cd php-7.2.12
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-libzip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts && make && make install

5)复制配置文件

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp /root/soft/php-7.2.12/php.ini-development /usr/local/php/etc/php.ini

6)配置开机自启

cp /root/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm

7)环境变量

echo 'PATH=/usr/local/php/bin:$PATH' >> /etc/profile
source /etc/profile

8)查看php版本

php -v
service php-fpm start

 

上一篇:centos7部署nginx-http-flv,ffmepg,视频流服务器部署最详细踩坑


下一篇:centos7 postgresql13 安装 zhparser,配置中文全文检索