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.