1、关闭firewall:
- systemctl stop firewalld.service
- systemctl disable firewalld.service
2、关闭SELINUX
- vi /etc/selinux/config
-
- SELINUX=disabled
- :wq!
- setenforce 0
3.安装apache
- yum install httpd
- systemctl start httpd.service
- systemctl stop httpd.service
- systemctl restart httpd.service
- systemctl enable httpd.service
4.安装mariadb(mysql)
- yum install mariadb mariadb-server
- systemctl start mariadb.service
- systemctl stop mariadb.service
- systemctl restart mariadb.service
- systemctl enable mariadb.service
- 修改mysql密码:set password for 'root'@'localhost'=password('root');
- mysql授权远程连接(navicat等): grant all on *.* to root identified by 'root';
5、安装PHP以及组件,使PHP支持 MariaDB
- yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
-
- systemctl restart mariadb.service
- systemctl restart httpd.service
测试篇
cd /var/www/html
vi index.php #输入下面内容
<?php
phpinfo();
?>
:wq! #保存退出
在客户端浏览器输入服务器IP地址,可以看到如下图所示相关的配置信息!