美文网首页
CentOS 7.4安装php7.1版本和nginx服务器

CentOS 7.4安装php7.1版本和nginx服务器

作者: antway | 来源:发表于2019-03-10 21:32 被阅读0次

这里介绍CentOS7.4上安装php7.1版本

1. 安装epel-release

yum install epel-release

2. 安装webtatic第三方rpm包

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

3. 然后可以安装php7.1版本

yum install php71w

4. 安装mysql, redis, memcache等扩展

yum install php71w-pdo php71w-mysql

yum install php71w-pecl-memcache

yum install php71w-pecl-redis

yum install php71w-fpm

5. 安装nginx服务器

yum install nginx

6. nginx配置文件中增加php配置,在nginx.conf的server段中增加

location ~ \.php?.*$ {

        fastcgi_pass  127.0.0.1:9000;

        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

        include        fastcgi_params;

    }

7. 启动nginx, php-fpm

systemctl enable nginx

systemctl enable php-fpm

systemctl start nginx

systemctl start php-fpm

8. 在/usr/share/nginx/html下新增phpinfo.php文件,内容为

<?php

phpinfo();

9. 用浏览器打开服务器上URL路径为/phpinfo.php的链接

可以查看服务器的php配置信息,php扩展信息

相关文章

网友评论

      本文标题:CentOS 7.4安装php7.1版本和nginx服务器

      本文链接:https://www.haomeiwen.com/subject/dxgppqtx.html