Home >Backend Development >PHP Tutorial >Ubuntu branch Linux operating system installation LAMP environment, ubuntulamp_PHP tutorial
Step1. Install Apache
Enter the command in the terminal
<span>sudo</span> apt-get <span>install</span> apache2
Open the browser and enter: 127.0.0.1 in the address bar. If "It works!" appears, the installation is successful
Step2. Install php5
Enter in terminal:
<span>sudo</span> apt-get <span>install</span> php5 libapache2-mod-php5 php5-mysql
Restart apache2:
<span>sudo</span> /etc/init.d/apache2 restart
sudo /etc/init.d/apache2 stop If you want to open the apache service, you can execute the following command: sudo /etc/init.d/apache2 start<span>sudo</span> gedit /var/www/testphp.php The restart, shutdown, and startup commands of mysql are also similar to the corresponding commands of apache2 |
<?php <span>phpinfo</span>(); ?>
Test whether php5 is installed successfully:
In the opened file, enter the following php code:
<span>sudo</span> apt-get <span>install</span> mysql-server mysql-client
Step3. Install mysql
Enter the following command in the terminal and execute it:
During the installation process, the interface for setting a password for the root user in mysql will appear. Just follow the prompts
<span>sudo</span> apt-get <span>install</span> libapache2-mod-auth-mysql php5-mysql phpmyadmin
Step4. Install phpmyadmin
<span>sudo</span> <span>chmod</span> <span>777</span> /var/www
Enter the following command in the terminal and execute
true