centos 7下php环境搭建
系统: centos 7.3
php : 5.4.16
apache: 2.4.6
MYSQL : 5.6
-1.打开阿里云实例网络和安全的安全组,选择配置规则对端口进行配置,开放80,3306等端口;*
- 2.安装Apache、PHP、mysql、连接mysql的数据包
yum -y install httpd
yum -y install php
yum -y install php-fpm
yum -y install mysql
yum -y install mysql-server (本项会出现错误!)
yum -y install php-mysql
- 3.mysql-server 的安装
centos 7将MYSQL 数据库软件从默认的程序列表中移除,用mariadb 代替;本文选择了 从官网下载mysql-server;
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
软件安装已完成;
- 4.配置
apache配置
systemctl start httpd 启动apache;
systemctl enable httpd 将apache加入到开机自动启动;
apche主要目录文件
apache主配置文件 etc/httpd/conf/httpf.conf 主要配置
在 var/www/html 文件里创建 index.html 或者 index.php 文件 ,重启服务器
systemctl restart httpd
mysql配置
->systemctl start mysqld
->systemctl enable mysqld
->mysql -u root -p
->
mysql 授权远程连接
mysql -uroot -p
GRANT ALL PRIVILEGES ON *.* TO '用户名'@'允许访问的ip' IDENTIFIED BY '密码' WITH GRANT OPTION;
<刷新>
flush privileges;
并非原创。。