卸载原来低版本的PHP
如果重装系统就不用走了 不重装有可能会报错 可走可不走
rpm -qa |grep php|xargs rpm -e
更新yum源
//CentOS/RHEL 7.x
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
查看可使用的php包
yum list | grep php
1
安装PHP常用模块
yum -y install php72-php php72-php-common php72-php-devel php72-php-gd php72-php-mysqlnd php72-php-pecl-mysql php72-php-pecl-memcached php72-php-pecl-memcache php72-php-pecl-redis php72-php-opcache
//装好后看一下装了哪些包
yum list installed |grep php
//最后重启下httpd
systemctl restart httpd
、
2.Apache
安装
yum install -y httpd
运行
/bin/systemctl start httpd.service
之后开启或者关闭:
systemctl start httpd
systemctl stop httpd
查看状态:
service httpd status
开启之后在浏览器输入ip就可以看到默认设置的index.html页面了
3.Mysql
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
成功安装之后重启mysql服务
service mysqld restart
初次安装mysql是root账户是没有密码的
设置密码的方法
mysql -uroot
mysql> set password for ‘root’@‘localhost’ = password(‘mypassword’);
mysql> exit
远程授权连接mysql
GRANT ALL PRIVILEGES ON . TO ‘%’@’%’ IDENTIFIED BY ‘qwer1234’ WITH GRANT OPTION;
Grant all privileges on . to ‘root’@’%’ identified by “root”;
FLUSH PRIVILEGES;
可以使用Navicat 之类的来管理Mysql数据库
之后就可以去这个目录 /var/www/html 下面放上网页测试了~