日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux 利用yum源安装php5.6+nginx

發(fā)布時(shí)間:2024/9/19 linux 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux 利用yum源安装php5.6+nginx 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

前言

  • CentOS 7
  • nginx1.12.2
  • php5.6
  • nginx已經(jīng)安裝完成,且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,啟動(dòng)php-fpm服務(wù)

shell> systemctl start php-fpm

7,檢查php-fpm服務(wù)

ps -ef | grep php-fpm netstat -tlnp | grep 9000

8,修改nginx配置,使nginx能夠?qū)hp腳本的處理轉(zhuǎn)給php-fpm模塊。

shell> vi /etc/nginx/conf.d/default.conf --------------默認(rèn)是注釋掉的,取消注釋即可。如果沒有,則添加。注意將/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

實(shí)際情況中,如重載nginx配置與此處給出的方式不同,自動(dòng)替換成其它方式即可。

10,編輯一個(gè)測試的php程序。

shell> vi /usr/share/nginx/html/index.php ----------/usr/share/nginx/html是document_root目錄--------- <?phpphpinfo(); ?>

11,輸入index.php頁面的輸出結(jié)果

http://localhost/index.php

12,設(shè)置session目錄訪問權(quán)限

cd /var/lib/php chown -R nginx:nginx *

務(wù)必保證php-fpm的啟動(dòng)賬戶(本文設(shè)置的啟動(dòng)賬戶為nginx)對(duì)存放session的目錄具有讀寫權(quán)限,否則將不能正確使用session。

其它

查看可以安裝的php插件:yum list php70w*

啟動(dòng)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/

總結(jié)

以上是生活随笔為你收集整理的Linux 利用yum源安装php5.6+nginx的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。