yum install epel-release -y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
安装mysqld
wget http://repo.mysql.com/mysql-community-release-el7-7.noarch.rpm
yum -y install mysql57-community-release-el7.rpm
yum -y install mysql-community-server
systemctl start mysqld
systemctl status mysqld
systemctl enable mysqld
查看开机启动项
systemctl list-unit-files|grep enabled
初始化数据库
mysql 进入数据库
mysql> set password for 'root'@'localhost' = password('Huayun@123');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
安装php
yum install epel-release
$ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ sudo yum install yum-utils
$ sudo yum-config-manager --enable remi-php72 $ sudo yum update
安装 PHP72
$ sudo yum install php72
输入 php72 -v 查看安装结果
安装 php-fpm 和一些其他模块:
$ sudo yum install php72-php-fpm php72-php-gd php72-php-json php72-php-mbstring php72-php-mysqlnd php72-php-xml php72-php-xmlrpc php72-php-opcache
三、php-fpm 服务
设置开机自启
$ sudo systemctl enable php72-php-fpm.service
常用 php-fpm 命令
# 开启服务
systemctl start php72-php-fpm.service
# # 停止服务
systemctl stop php72-php-fpm.service
# # 查看状态
systemctl status php72-php-fpm.service
一、安装源
四、路径整理
配置nginx
[root@localhost php]# cat /usr/share/nginx/php/index.php
<?php phpinfo(); ?>
[root@localhost php]# cat /etc/nginx/conf.d/php.conf
server {
listen 80;
server_name php.nineya.com;
index index.php;
root /usr/share/nginx/php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
写入phpinfo 文件 在浏览器中确认
[root@localhost php]# cat /usr/share/nginx/php/index.php
<?php phpinfo(); ?>