PHP environment configuration under CentOS 7 in the VM, under CentOS 7

Source: Internet
Author: User

PHP environment configuration under CentOS 7 in the VM, under CentOS 7

For simplicity, set the VM Nic to the bridging mode

1. yum install httpd php

2. yum install mariadb

3. Start mariadb

Systemctl start mariadb. service # start MariaDB

Systemctl stop mariadb. service # stop MariaDB

Systemctl restart mariadb. service # restart MariaDB

Systemctl enable mariadb. service # Set startup

Create a new user for remote access

Mysql-u root-p enters the database
User mysql; # Use the mysql System database insert into user (Host, User, Password) values ('%', 'test', PASSWORD ('123 ')); # Insert a new account named test as test with the Password 123. You can modify the Update user set PASSWORD = Password ('123') as needed ') where User = 'root' # change the root password to 123 and use select * from user to reset the root password; # Check whether the User is added

Grant all privileges on *. * to test @ '%' identified by '000000'; test is the account and % is the host address. Currently, all 123 represents the password.

FlushPrivileges; refresh

Select user, host from user; # Check whether the user is added

 

4. Disable the firewall to allow hosts to access websites in virtual machines.

Systemctl stop firewalld. service # stop firewall

Systemctl disable firewalld. service # disable firewall startup

5. You can access the VM by enabling the vm ip address on the host.

6. Test PHP

Cd/var/www/html

Vi index. php # enter the following content

<? Php

Phpinfo ();

?>

: Wq! # Save and exit

Enter the Server IP address in the browser of the client. The configuration information shown in is displayed!

 

 

Note: The default program directory of apache is/var/www/html.

Permission settings: chown apache. apache-R/var/www/html

Now, the installation and configuration of the LAMP server (Apache + PHP + MariaDB) in CentOS 7.0 is complete!

 


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.