For simplicity, the virtual machine NIC is set to bridge mode
1.yum Install httpd PHP
2.yum Install MARIADB
3. Start MARIADB
Systemctl Start Mariadb.service #启动MariaDB
Systemctl Stop Mariadb.service #停止MariaDB
Systemctl Restart Mariadb.service #重启MariaDB
Systemctl Enable Mariadb.service #设置开机启动
Create a new user to use for remote access
mysql -u root -p Enter database
user MySQL; #使用mysql系统数据库insert into user (Host,user , Password) VALUES ('% ', ' test ', Password (' 123 ')); #插入一个名为test的新用帐号为test, the password is 123, you can modify the update user set Password=password (' 123 ') where user= ' root ' #将root密码改为123 according to its own needs, As the reset root password, select * from user; #查看用户是否加入
grant all privileges on *.* to [email protected]‘%‘ identified by ‘123‘; test为账号,%为主机地址,目前代表所有 123代表密码
flush privileges; 刷新
select user,host from user; #查看用户是否加入
4. Turn off the firewall so that the host can access the Web site in the virtual machine
Systemctl Stop Firewalld.service #停止firewall
Systemctl Disable Firewalld.service #禁止firewall开机启动
5. Host opens virtual machine IP for access
6. Test PHP
Cd/var/www/html
VI index.php #输入下面内容
<?php
Phpinfo ();
?>
: wq! #保存退出
In the client browser enter the server IP address, you can see the configuration information as shown in the relevant!
NOTE: The Apache default program directory is/var/www/html
Permission settings: Chown apache.apache-r/var/www/html
At this point, the CentOS 7.0 installation configuration Lamp server (APACHE+PHP+MARIADB) tutorial is complete!
PHP Environment configuration under CentOS 7 in virtual machine