PHP Environment configuration under CentOS 7 in virtual machine

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.