1.下载
去官网下载。
2、上传并解压
tar -zxvf php-7.2.10.tar.gz
3、进入文件夹
cd php-7.2.10
4、安装相关依赖包
yum install pcre pcre-devel zlib zlib-devel openssl openssl-devel gd gd-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel lua-devel autoconf libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel libidn libidn-devel libtool libtool-libs libevent-devel libevent openldap openldap-devel nss_ldap openldap-clients openldap-servers libtool-ltdl libtool-ltdl-devel bison libgcrypt php-mcrypt libmcrypt libmcrypt-devel cmake gcc gcc-c++ ncurses-devel perl-Data-Dumper libicu-devel libquadmath-devel python-devel bzip2-devel
5、编译
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --with-png-dir --with-libxml-dir --with-mhash
6、全部编译完成之后执行:
make && make install
make安装完成之后会出现目录/usr/local/php;
7、配置启动:
cp php.ini-development /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp sapi/fpm/php-fpm /usr/local/bin
然后启动 php-fpm 服务
/usr/local/bin/php-fpm
执行以下命令查看是否启动成功,是否有进程
ps -ef | grep php
如果需要结束php-fpm进程
pkill php-fpm