Linux 利用yum源安装php5.6+nginx
前言
- CentOS 7
- nginx1.12.2
- php5.6
- nginx已经安装完成,且document root 目录为/usr/share/nginx/html。
步骤
1,添加php5.6源
shell> yum install epel-release
shell> rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
2,查看php5.6源
shell> yum info php56w
Name : php56w
Arch : x86_64
Version : 5.6.40
Release : 1.w7
Size : 9.3 M
Repo : installed
From repo : webtatic
Summary : PHP scripting language for creating dynamic web sites
URL : http://www.php.net/
License : PHP and Zend and BSD
Description : PHP is an HTML-embedded scripting language. PHP attempts to make it: easy for developers to write dynamically generated web pages. PHP also: offers built-in database integration for several commercial and: non-commercial database management systems, so writing a: database-enabled webpage with PHP is fairly simple. The most common: use of PHP coding is probably as a replacement for CGI scripts.:: The php56w package contains the module (often referred to as mod_php): which adds support for the PHP language to Apache HTTP Server.
3,安装php5.6
shell> yum install php56w php56w-fpm
4,查看php版本
shell> php -v
PHP 5.6.40 (cli) (built: Jan 12 2019 13:11:15)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
5,接下来配置/etc/php-fpm.d/www.conf,将user和group改为nginx。
shell> vi /etc/php-fpm.d/www.conf
user = nginx
group = nginx
6,启动php-fpm服务
shell> systemctl start php-fpm
7,检查php-fpm服务
ps -ef | grep php-fpm
netstat -tlnp | grep 9000
8,修改nginx配置,使nginx能够将php脚本的处理转给php-fpm模块。
shell> vi /etc/nginx/conf.d/default.conf
--------------默认是注释掉的,取消注释即可。如果没有,则添加。注意将/script改为$document_root---------------location ~ \.php$ {root /usr/share/nginx/html;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}
root的值需要修改为/usr/share/nginx/html。
fastcgi_param的值需要修改为$document_root$fastcgi_script_name;
。
9,nginx重载配置
shell> nginx -s reload
实际情况中,如重载nginx配置与此处给出的方式不同,自动替换成其它方式即可。
10,编辑一个测试的php程序。
shell> vi /usr/share/nginx/html/index.php
----------/usr/share/nginx/html是document_root目录---------
<?phpphpinfo();
?>
11,输入index.php页面的输出结果
http://localhost/index.php
12,设置session目录访问权限
cd /var/lib/php
chown -R nginx:nginx *
务必保证php-fpm的启动账户(本文设置的启动账户为nginx)对存放session的目录具有读写权限,否则将不能正确使用session。
其它
查看可以安装的php插件:yum list php70w*
启动php-fpm:systemctl start php-fpm 或 /usr/sbin/php-fpm
停止php-fpm:systemctl stop php-fpm
重启php-fpm:systemctl restart php-fpm
php-fpm配置文件:/etc/php-fpm.conf /etc/php-fpm.d/*.conf
参考
https://webtatic.com/packages/php56/
Linux 利用yum源安装php5.6+nginx相关推荐
- Linux 利用yum源安装php7.0+nginx
环境 1, CentOS 7 2, nginx1.12.2 3, php7.0 nginx已经安装完成,且document root 目录为/usr/share/nginx/html. 步骤 1,添加 ...
- Linux 利用yum源安装nginx
环境 1, CentOS 7 2, nginx 1.12.2 步骤 1,添加nginx源 rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS ...
- Linux 利用yum源安装subversion(svn)客户端
前言 CentOS 7 subversion(svn) 安装过程 yum 方式安装 shell> yum install subversion 检查是否安装成功 shell> svn -- ...
- linux 利用yum源安装mysql5.7
前言 CentOS 7 MySQL 5.7 查找mysql源 http://repo.mysql.com 步骤 添加mysql源 shell> rpm -ivh http://repo.mysq ...
- Linux 通过yum源安装subversion(svn)服务端
目录 前言 通过yum源安装subversion(svn)服务端 基本的SVN服务端配操作 确定一个SVN目录 新建SVN仓库 给SVN仓库添加用户 给SVN仓库的用户授权 SVN仓库配置 启动服务器 ...
- Centos 利用yum源安装 nginx stream模块
环境 CentOS 7.9 (腾讯云服务器) nginx 1.20.1 配置stream参考这里. nginx 动态模块 nginx 1.9.11 开始增加加载动态模块支持,从此不再需要替换nginx ...
- CentOS 8 利用yum源安装nginx
环境 1, CentOS 8 2, nginx 1.18.0 步骤 1,先安装 yum-utils shell> yum install yum-utils 2,添加nginx源.创建文件/et ...
- Centos 利用yum源安装 nginx 1.20.1
环境 CentOS 7.9 (腾讯云服务器) nginx 1.20.1 yum源说明 腾讯云的 CentOS 服务器,用的是腾讯的yum源镜像. 感兴趣的可以去/etc/yum.repos.d中看看. ...
- linux中yum源安装dhcp,24.Linux系统下动态网络源部署方法(dhcpd)
1.安装dhcp软件 注意:安装时需要有配置好的yum仓库,关于yum仓库的配置,祥见Linux下系统的软件安装以及yum源配置(yum仓库搭建.yum命令.rpm命令) [root@servser ...
最新文章
- Eclipse Spring Boot实现热部署
- c#匿名方法用途_C#的匿名方法
- DCMTK:测试dcmiod的颜色转换功能
- zabbix db partition
- c++ 数组的输入遇到特定字符停止输入_滑动窗口思维--挑战“无重复字符的最长子串”
- suse linux 10 ftp服务配置
- ​​​​iPhone 或 Mac 忘记登录密码,怎么快速找回
- 2017.11.24 Stm8L151-factory
- WINDOWS BAT的命令,双引号位置要注意
- 【脑电信号】基于matlab GUI小波变换癫痫脑电信号特征提取及分析【含Matlab源码 1154期】
- 11.收货地址模块-新增收货地址①
- android横竖屏切换布局闪退,Android 横竖屏切换以及横屏启动闪退问题
- 中国古代兵器与兵书·铁马驰骋
- c语言小学生四则运算出题程序
- C盘瘦身:QQ文件的清理及Group2文件夹
- python找不到解释器_解决pycharm找不到解释器的问题
- 编译内核 解决 Gentoo 在 AUSU P5B SE 板载网卡 无法上网
- poj 2942 点双连通分量
- C语言实现植物大战僵尸自动收集阳光(一) 问题分析与寻找基址
- Android 属性动画(一)新手入门