1: First install apache: open the terminal (ctrl + Alt + t ),
Enter the following command:
Sudo apt-get install apache2
To install,
After installation, open your browser and enter localhost or http: // 127.0.0.1 in the address bar.
If you see It works, the installation is successful!
Default root directory:
/Var/www/
2: install mysql:
After sudo apt-get install mysql-server is installed, you will be asked to set a new mysql root password, enter your own password, enter the key, and then confirm the password.
3: install PHP 5 and Apache PHP 5 module:
Sudo apt-get install php5 libapache2-mod-php5
Sudo/etc/init. d/apache2 restart (restart apache)
The attempt is successful. No:
Command:
Sudo gedit/var/www/text. php [create a text. php file under the default apache root directory/var/www]
Enter the following code in the text. Php file to check whether the installation is successful:
<? Php
Echo "helloworld ";
?>
In the browser address bar, enter:
Http: // localhost/text. php if helloworld is displayed on the page, the request is successful.
Tip: If you cannot enter the command again when you return to the terminal, press ctrl + z.
4. Make apache and php support mysql:
Sudo apt-get install libapache2-mod-auth-mysql
Sudo apt-get install php5-mysql
Sudo/etc/init. d/apache2 restart (restart apache)
Now the environment has been set up!
/Var/www/(put the apache2 webpage file here)
/Var/lib/mysql (put the mysql file here)
If you want to connect remotely, you need to install SSH with the command: sudo apt-get install ssh
Maybe we are still used to phpmyadmin.
5. Install phpmyadmin.
Sudo apt-get install phpmyadmin
Enter http: // localhost/phpmyadmin in the browser to find not found.
Therefore, you must transfer the installation to the phpmyadmin folder to/var/www/.
Sudo ln-s/usr/share/phpmyadmin // var/www/
Run the preceding command to transfer the phpmyadmin folder to the destination. Alternatively, you can copy phpmyadmin directly to the/var/www/folder.
When we enter http: // localhost/phpmyadmin in the browser again, we find that the interface we are familiar with is back.