声明:1.我下载文件在 /root 文件夹下,解压也在这个文件夹下 2.安装在 /usr/local/php-7.2.19 文件夹下
首先首页root用户执行
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libxslt libxslt-devel
然后到 https://www.php.net/downloads.php 这个页面挑选PHP版本,我使用的是 php-7.2.19.tar.gz
wget https://www.php.net/distributions/php-7.2.19.tar.gz
下载完成后解压
tar -zxvf php-7.2.19.tar.gz
然后进入解压目录
cd php-7.2.19
然后开始执行PHP检查
./configure --prefix=/usr/local/php-7.2.19 \
--with-config-file-path=/usr/local/php-7.2.19/etc \
--with-curl \
--with-mhash \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-openssl \
--with-pcre-regex \
--with-pdo-sqlite \
--with-pear \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-xml \
--enable-zip \
--enable-static \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir