准备工作
- 一台装有Centos7的服务器
安装PHP7
1.更换yum源 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 2.安装PHP7 yum install -y php70w 3.安装PHP的常用扩展 yum install -y php70w-pecl-redis.x86_64 php70w-mysql.x86_64 php70w-mcrypt.x86_64 php70w-pdo.x86_64 php70w-soap.x86_64 php70w-devel.x86_64 php70w-bcmath.x86_64 php70w-gd.x86_64 php70w-opcache.x86_64
安装Apache
yum install -y httpd
安装Mysql
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum install -y mysql-server 1.启动mysql systemctl restart mysqld.service 2.登录数据库,修改密码 mysql -uroot SET PASSWORD FOR 'root'@'localhost' = PASSWORD('你的密码');
设置开机自动启动
systemctl enable httpd.service
启动 Apache
systemctl start httpd.service