centos7 nginx+php5.6+mysql安装与配置
Posted magma
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 nginx+php5.6+mysql安装与配置相关的知识,希望对你有一定的参考价值。
安装与配置
php 56的安装
php的配置写在 php.ini,可在phpinfo()中查看
//查找已安装
yum list installed | grep php
// php卸载
yum -y remove php56*
yum remove httpd* php*
可用的资源:
centos 安装php56+nginx
nginx + php-fpm
nginx安装
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
sudo yum install -y nginx
sudo systemctl start nginx.service
// 开机启动
sudo systemctl enable nginx.service
- nginx 配置
location ~ \\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAM $document_root$fastcgi_script_name;
include fastcgi_params;
}
- php-fpm (使用php-fpm -t 可以看到其配置所在)
sudo service php-fpm reload
sudo service php-fpm restart
php重启
重启php-fpm即可
sudo service php-fpm reload
sudo service php-fpm restart
mysql
mysql启动
systemctl start mysqld.service
tip
初始密码获取:
cat /var/log/mysqld.log | grep -i ‘temporary password‘
以上是关于centos7 nginx+php5.6+mysql安装与配置的主要内容,如果未能解决你的问题,请参考以下文章
LNMP环境搭建(CentOS7+Nginx1.10.1+MySQL5.6.31+PHP5.6.22)