---恢复内容开始---
ps:一切从简
一、安装所需环境
yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libzip-devel pcre-devel
二、下载及安装nginx
1.下载php
wget http://cn2.php.net/distributions/php-7.3.3.tar.gz
2.解压php
tar -xzf php-7.3.3.tar.gz
3.进入php目录
cd php-7.3.3
3.编译php(我们不提供apxs参数,相反,我们提供php-fpm相关参数)
./configure --prefix=/usr/local/php7 \
--with-config-file-path=/usr/local/php7/etc \
--with-config-file-scan-dir=/usr/local/php7/etc/php.d \
--with-mcrypt=/usr/include \
--enable-mysqlnd \
--with-mysqli \
--with-pdo-mysql \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--with-gd \
--with-iconv \
--with-zlib \
--enable-xml \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--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
-----------------------start---------------------------
假如编译完成之后报错:
“checking for libzip... configure: error: system libzip must be upgraded to v”
执行一下,没有报错则忽略。
wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -xzf libzip-1.2.0.tar.gz
./configure
make && make install
----------------------------end-------------------------
出现以下则表示编译成功
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+Thank you for using PHP.
然后执行:
make test(如果出现什么问题请谷歌或百度,或者往下看看能解决不)
--------------start----------------
如果这里报错:
/usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or directory
则执行一下命令,没有则忽略。
find / -name zipconf.h
cp /你zipconf.h所在的目录 //usr/local/include/zipconf.h
然后重新 configure 成功之后在make test,没问题则继续执行后面的命令。
---------------end--------------------
make && make install -j2
三、配置php
1.复制ini文件
cp php.ini-production /usr/local/php7/etc/php.ini
2.配置fpm
cd /usr/src/php-7.0.0/sapi/fpm
cp init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on