centos 6.9 x64 yum安装PHP 7.1.8
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos 6.9 x64 yum安装PHP 7.1.8相关的知识,希望对你有一定的参考价值。
centos 6.9 x64 yum安装php 7.1.8
安装源
yum install epel-release
rpm -Uvh http://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
查看安装完的状态
[[email protected] ~]# 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
查找安装路径
[[email protected] 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
查看服务端口是否已启动
[[email protected] 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 {
listen 80;
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
本文出自 “虚拟化应用” 博客,请务必保留此出处http://liwenhn.blog.51cto.com/854522/1963791
以上是关于centos 6.9 x64 yum安装PHP 7.1.8的主要内容,如果未能解决你的问题,请参考以下文章
如何在 CentOS 7.0 x64 上安装 MCrypt PHP 扩展
CentOS 6.9 yum方式安装LAMP环境,并部署Discuz
Centos 6.9 编译安装 apache 2.4+php7.2.3 + Fast-cgi