Setting up the environment of lamp under CENTOS7

Source: Internet
Author: User
Tags install php php server php and phpinfo

CentOS7.0 under the lamp environment.

Let me say a little bit about the installation step (I'm using a Yum installation here)

First install Apache Server Software httpd
Yum-y Install httpd

Start the httpd service (CentOS7 has a new way to start the service Systemctl Start/restart Xxx.service)

Systemctl Start Httpd.service

Set up automatic startup (new method to use CentOS7 Systemctl enable Xxx.service)

Systemctl Enable Httpd.service

Install MARIADB database (MySQL database)
CentOS 7.0, the MySQL database has been replaced with MARIADB

Yum-y Install Mariiadb-server mariadb

Start the MARIADB service

Systemctl Start Mariadb.service
Note: If you start the service with the following error stating that the knowledge of the code just executed has been upgraded, it is not really installed.
Failed to issue method Call:unit Mysqld.service Failed to load:no such file or directory.

You will need to execute the following code again:

Yum-y Install mariadb Mariadb-server

The following prompts show that the installation was successful

Set up automatic boot

Systemctl Enable Mariadb.service

Set the database password

mariadb [Mysql]>use MySQL;
mariadb [mysql]>update User Setpassword=password (' newpassword ') WHERE user= ' root '; 
MARIADB [Mysql]>flush privileges;

Install PHP and extension modules to enable PHP to support MARIADB databases

Yum-y Install PHP php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp Php-soap Curl Curl-devel

The following results show that the installation was successful

Restart the Apache server

Systemctl Restart Httpd.service
You can set the time zone
Open PHP configuration file:
vi/etc/php.ini
Find;d ate.timezone = 
Remove the preceding semicolon and change to Date.timezone = PRC
(the Apache server settings need to be restarted to take effect )

Test is configured successfully

vi/var/www/html/phpinfo.php  
Enter the following code
<?php phpinfo ();?> 
Wq Save exit

Open http://localhost/phpinfo.php If you can see the PHP configuration Information page, the PHP server is normal. Of course, localhost can be replaced with your IP.

At this point, the lamp platform is built.

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.