Install the LAMP environment _ php instance in Linux

Source: Internet
Author: User
This article describes how to install the LAMP environment in a Linux operating system. It is very detailed. If you need it, you can refer to it. Step1. install Apache

Enter the command in terminal

The Code is as follows:

Sudo apt-get install apache2

Open your browser and enter 127.0.0.1 in the address bar. If "It works!" appears !", Indicates that the installation is successful.

Step 2 install php5

In terminal, enter:

The Code is as follows:

Sudo apt-get install php5 libapache2-mod-php5 php5-mysql

Restart apache2:

The Code is as follows:

Sudo/etc/init. d/apache2 restart

Note: To disable the apache service, run the following command:

Sudo/etc/init. d/apache2 stop

To open the apache service, run the following command:

Sudo/etc/init. d/apache2 start

The restart, close, and start commands of mysql are similar to those of apache2.

Test whether php5 is successfully installed:

The Code is as follows:

Sudo gedit/var/www/testphp. php

In the open file, enter the following php code:

The Code is as follows:

<? Php phpinfo ();?>

Save and close the file. In the address bar of the browser, enter the following ip Address: 127.0.0.1/testphp. php. If any information about php appears, it indicates that php is successfully installed.

Step 3 install mysql

Run the following command in terminal:

The Code is as follows:

Sudo apt-get install mysql-server mysql-client

During the installation process, the password setting interface is displayed for the root user in mysql. Just follow the prompts.

  

Step 4. Install phpmyadmin

Enter the following command in terminal and execute

The Code is as follows:

Sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

Adjust the permissions of the/var/www directory to facilitate editing website files in the future.

The Code is as follows:

Sudo chmod 777/var/www

The above is all the content of this article. I hope you will like it.

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.