centos 6.9 x64 yum安装PHP 7.1.8

前端之家收集整理的这篇文章主要介绍了centos 6.9 x64 yum安装PHP 7.1.8前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

centos 6.9 x64 yum安装PHP 7.1.8


安装源

yum install epel-release

rpm -Uvhhttp://mirror.webtatic.com/yum/el6/latest.rpm


根据你的需要安装PHP的组件,下面我就安装所有的了。

yum install PHP71w PHP71w-MysqL PHP71w-odbc PHP71w-common PHP71w-embedded PHP71w-pgsql PHP71w-xml PHP71w-ldap PHP71w-fpm PHP71w-gd PHP71w-pdo PHP71w-devel PHP71w-mbstring PHP71w-mcrypt PHP71w-cli PHP71w-json PHP71w-imap PHP71w-bcmath mod_PHP71w PHP71w-pear


查看安装完的状态

[root@vm01 ~]# rpm -qa |grep PHP

PHP71w-pdo-7.1.8-2.w6.x86_64

PHP71w-process-7.1.8-2.w6.x86_64

PHP71w-xml-7.1.8-2.w6.x86_64

PHP71w-pgsql-7.1.8-2.w6.x86_64

PHP71w-mcrypt-7.1.8-2.w6.x86_64

PHP71w-pear-1.10.4-1.w6.noarch

PHP71w-MysqL-7.1.8-2.w6.x86_64

PHP71w-embedded-7.1.8-2.w6.x86_64

PHP71w-bcmath-7.1.8-2.w6.x86_64

mod_PHP71w-7.1.8-2.w6.x86_64

PHP71w-common-7.1.8-2.w6.x86_64

PHP71w-cli-7.1.8-2.w6.x86_64

PHP71w-gd-7.1.8-2.w6.x86_64

PHP71w-imap-7.1.8-2.w6.x86_64

PHP71w-devel-7.1.8-2.w6.x86_64

PHP71w-odbc-7.1.8-2.w6.x86_64

PHP71w-mbstring-7.1.8-2.w6.x86_64

PHP71w-ldap-7.1.8-2.w6.x86_64

PHP71w-fpm-7.1.8-2.w6.x86_64


查找安装路径

[root@sg Nginx]# whereis PHP-fpm

PHP-fpm: /usr/sbin/PHP-fpm /etc/PHP-fpm.conf /etc/PHP-fpm.d /usr/share/man/man8/PHP-fpm.8.gz


启动PHP服务

service PHP-fpm start


查看服务端口是否已启动

[root@sg Nginx]# netstat -lnt | grep 9000

tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN



加入自启动

chkconfig PHP-fpm on


关闭服务

service PHP-fpm stop


PHP安装完成后,不用配置即可与Nginx结合使用

一定要给网站document_root目录权限,不然PHP提示文件找不到。

chmod -R 755 /home/evan


下面是我的Nginx的配置例子,供参考

vi /etc/Nginx/Nginx.conf


server {

listen 80;

server_name www.link.top www.rrweb.com;

charset utf-8;

root /home/evan;


location / {

index index.html index.PHP;

}


location ~ \.PHP$ {

root /home/evan/QRcode;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.PHP;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include /etc/Nginx/fastcgi_params;

}

server {

listen 80;

server_name link.top;

return 301 http://www.link.top$request_uri;

}


server {

server_name rrweb.com;

return 301 http://www.rrweb.com$request_uri;

}


重起Nginx服务

service Nginx restart


备注说明

/home/evan/QRcode 目录放PHP网站文件

/home/evan/ 目录放静态html网站文件


测试完成日期:

2017.09.08

猜你在找的CentOS相关文章