centos7编译安装PHP7,并配置nginx

本教程安装的PHP版本为php-7.1.5,centos版本为CentOS Linux release 7.3.1611 (Core)

nginx为yum安装

步骤:

1.下载源码
2.更新所需组件
3.解压
4.编译
5.配置
6.启动
7.应用

邵东网站建设公司创新互联,邵东网站设计制作,有大型网站制作公司丰富经验。已为邵东近1000家提供企业网站建设服务。企业网站搭建\成都外贸网站建设公司要多少钱,请找那个售后服务好的邵东做网站的公司定做!

一.下载源码

wget http://download.niexin.me/php/linux/php-7.1.5.tar.gz

二.更新所需组件

yum -y install libxml2-devel libxml2 gcc libcurl libcurl-devel openssl openssl-devel libpng libpng-devel freetype freetype-devel libxslt libxslt-devel libjpeg libjpeg-devel libxml2 libxml2-devel pcre-devel

三.解压

tar -zxvf php-7.1.5.tar.gz

四.编译

cd php-7.1.5/

./configure \--prefix=/usr/local/php \--with-curl \--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-xmlrpc \--with-xsl \--with-zlib \--enable-fpm \--enable-bcmath \--enable-libxml \--enable-inline-optimization \--enable-gd-native-ttf \--enable-mbregex \--enable-mbstring \--enable-opcache \--enable-pcntl \--enable-shmop \--enable-soap \--enable-sockets \--enable-sysvsem \--enable-xml \--enable-zip

make && make install

五.配置

还是在php-7.1.5/目录下
# cp php.ini-development /usr/local/php/lib/php.ini
# 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 -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm

六.启动

/etc/init.d/php-fpm
开机启动:
vim /etc/rc.local
新增一行,写入/etc/init.d/php-fpm>dev/null 2>&1

七.应用:

nginx:

# vim /etc/nginx/nginx.conf
在server节点中添加以下内容

location ~ \.php$ {        root           /usr/share/nginx/html;        fastcgi_pass   127.0.0.1:9000;        fastcgi_index  index.php;        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;        include        fastcgi_params;    }


最后重启nginx:systemctl restart nginx

分享文章:centos7编译安装PHP7,并配置nginx
地址分享:https://www.cdcxhl.com/article2/spoc.html

成都网站建设公司_创新互联,为您提供App开发动态网站虚拟主机外贸网站建设网站制作品牌网站建设

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网站建设