To install the Linux, Apache, MySQL, PHP (LAMP) stack on Debian 9 Stretch, follow these steps:
sudo apt update
sudo apt install apache2
sudo apt install mysql-server
During the installation process, you will be prompted to set a root password for MySQL. Make sure to choose a strong password and remember it, as you will need it later.
sudo apt install php7.0 libapache2-mod-php7.0
This will install PHP and the Apache PHP module, which allows Apache to process PHP scripts.
sudo a2enmod php7.0
sudo systemctl restart apache2
info.php
:sudo nano /var/www/html/info.php
Add the following lines to the file:
<?php phpinfo(); ?>
Save the file and exit the editor.
http://localhost/info.php
. You should see a page displaying information about your PHP installation. If you see this page, it means that the LAMP stack is working correctly.That's it! You now have a fully functional LAMP stack on your Debian 9 Stretch system. You can now use PHP and MySQL to develop web applications.