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

这里介绍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扩展信息

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容