php centos7通过百胜安装指定版本的方法

  介绍

这篇文章主要介绍了centos7通过百胜安装指定php版本的方法,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获。下面让小编带着大家一起了解一下。

centos7通过百胜安装指定版本的php的方法:1、安装源;2,执行【yum安装php - y】命令选择对应版本的php进行安装;3,添加php常用扩展;4,执行【systemctl重启】命令启动php。

 centos7通过百胜安装指定php版本的方法

1,安装源

安装epel-release:

yum - y安装epel-release

添加雷米源:

rpm -Uvh http://rpms.remirepo.net/enterprise/remi -释放- 7. - rpm

安装yum-config-manager实用程序:

yum - y安装yum-utils

2,安装php

选择对应的版本进行安装

安装PHP5.4:

yum安装php - y

安装PHP7.0:

yum-config-manager——使remi-php70 yum - y安装php php-opcache

安装PHP7.1:

yum-config-manager——使remi-php71 yum - y安装php php-opcache

安装前可使用yum搜索php71搜索可安装的软件包。

完成后还需要添加php常用扩展:

yum - y安装php mysql php-gd php-ldap php odbc php-pear php xml php-xmlrpc php-mbstring php-soap curl curl-devel yum - y php71-php-fpm.x86_64安装   php systemctl重启php71-php-fpm #启动   netstat -tunlp | grep 9000 #查看php启动状态   vim/etc/opt/remi/php71/php-fpm.d/www.conf   用户=nginx #修改用户为nginx   组=nginx #修改组为nginx

(视频教程推荐:php视频教程)

3, nginx配置

安装nginx

yum安装nginx #安装nginx vim/etc/nginx/conf.d/test.conf      服务器{   听80;   #听[:]:80;   server_name 39.105.1.170;   client_max_body_size 50米;      位置/{   utf - 8字符集;   根/var/www;   指数指数。html你;   }   ~ \位置。php $ {   根/var/www;   fastcgi_pass 127.0.0.1:9000;   fastcgi_index index . php。   fastcgi_param SCRIPT_FILENAME/var/www fastcgi_script_name美元;   包括fastcgi_params;   }   }

启动nginx

nginx - s重载#启动nginx

在/var/www新建两个文件,一个html文件,一个php文件

test.html的内容为:      & lt; h2>你好World      test.php的内容为:      php & lt; ?   phpinfo ();   祝辞;

浏览器访问:39.105.1.170/测试。html和39.105.1.170/测试。php

感谢你能够认真阅读完这篇文章,希望小编分享centos7通过百胜安装指定php版本的方法内容对大家有帮助,同时也希望大家多多支持,关注行业资讯频道,遇到问题就找,详细的解决方法等着你来学习!

php centos7通过百胜安装指定版本的方法