How To Install Linux, Apache, MySQL, PHP (LAMP) Stack on Debian 9 Stretch
Here are the steps to install the LAMP stack on Debian 9 Stretch:
- Install Apache Web Server:
sudo apt-get update sudo apt-get install apache2 - Install MySQL Server:
sudo apt-get install mysql-serverDuring the installation, you'll be prompted to set a root password for MySQL.
- Install PHP:
sudo apt-get install php libapache2-mod-php php-mysql - Configure Apache to use PHP:
sudo nano /etc/apache2/mods-enabled/dir.confChange the order of the files so that index.php is listed first:
<IfModule mod_dir.c> DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htmrn</IfModule> - Restart Apache:
sudo systemctl restart apache2 - Verify the LAMP installation by creating a test PHP file:
sudo nano /var/www/html/info.phpAdd the following code to the file:
<?php phpinfo(); ?> - Access the test PHP file in your web browser:
http://your_server_ip_or_domain/info.php
