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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

centos7.0安装php,centos7.3安装php7.0

發布時間:2025/3/20 php 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos7.0安装php,centos7.3安装php7.0 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

需求:在Centos7.3下搭建LNMP環境

文章轉載自:http://blog.csdn.net/wszll_alex/article/details/76285324 作者:1. 關閉防火墻和selinux

打開文件selinux

vim/etc/sysconfig/selinux將文件中SELINUX=enforcing改為disabled,然后執行”setenforce 0″不用重啟地關閉selinux。

SELINUX=disabled關閉放火墻

systemctl stop firewalld.service

2.安裝軟件2.1.MYSQL安裝

下載MySQL的repo源

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

安裝mysql-community-release-el7-5.noarch.rpm包

rpm-ivh mysql-community-release-el7-5.noarch.rpm安裝MYSQL

? sudo yum install-y mysql-server? 更改MYSQL用戶權限:

sudo chown-R root:root /var/lib/mysql? 重啟服務:

systemctl restart mysql.service登錄,并修改密碼:

mysql-u root

mysql>use mysql;

mysql> update user set password=password(‘123456‘) where user=‘root‘;

mysql>exit;

2.2nginx安裝

下載對應當前系統版本的nginx包

? wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

建立nginx的yum倉庫(默認yum是沒有nginx的)

rpm-ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm下載并安裝nginx

? yum install-y nginxnginx啟動

? systemctl start nginx.service

2.3安裝php

rpm 安裝 Php7 相應的 yum源

rpm-Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

安裝php7.0yum install-y php70w安裝PHP擴展

yum install-y php70w-mysql.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64安裝php FPM

? yum install-y php70w-fpm

3. 修改配置文件3.1修改Nginx配置文件

nginx配置文件位置:(/etc/nginx/conf.d/default.conf)

vim/etc/nginx/conf.d/default.conf? 修改 root目錄,可自定義:

root/forest/nginxDir/html;? 配置php解析,修改 下面代碼中黑色加粗部分:

location~.php$ {

root/forest/nginxDir/html;

? fastcgi_pass127.0.0.1:9000;

? fastcgi_index index.php;

?fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

? include fastcgi_params;

? }

3.2 修改php-fpm配置文件

php-fpm配置文件位置:(/etc/php-fpm.d/www.conf)

? 修改

user=nginx

? group=nginx

4.放入測試文件

cd/forest/nginxDir/html

echo'hello eric' >index.php

5.啟動服務5.1啟動nginx服務:

systemctl start nginx.service? 查看啟動狀態:

systemctl status nginx看到以下字眼說明啟動成功!

?Active: active (running) since 六2016-11-19 13:40:04CST; 50min ago5.2.啟動PHP-FPM:

systemctl start php-fpm.service? 查看啟動狀態:

systemctl status php-fpm.service看到以下字眼說明啟動成功!

?Active: active (running) since 六2016-11-19 14:14:33CST; 18min ago6.測試

在瀏覽器打開192.168.44.129:80/index.php

看到 hello eric 就大功告成~

設置開機自啟動服務

systemctl enable php-fpm.servicesystemctl enable nginx.service

如項目框架為lavarel,則配置文件可用下面這個:

server {

listen 80;

server_name learn.laravel5.com;

root /var/www/html/learnlaravel5/public;

index index.html

index.php;

location / {

try_files $uri $uri/

/index.php$is_args$query_string;

}

location ~ .php$ {

try_files $uri =404;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME

$document_root$fastcgi_script_name;

include fastcgi_params;

}

}

總結

以上是生活随笔為你收集整理的centos7.0安装php,centos7.3安装php7.0的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。