How To Install Linux, Apache, MySQL, PHP (LAMP) Stack on Debian 9 Stretch

https:‮w//‬ww.lautturi.com
How To Install Linux, Apache, MySQL, PHP (LAMP) Stack on Debian 9 Stretch

To install the Linux, Apache, MySQL, PHP (LAMP) stack on Debian 9 Stretch, follow these steps:

  1. Update the package manager's package list:
sudo apt update
  1. Install Apache by running the following command:
sudo apt install apache2
  1. Install MySQL by running the following command:
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.

  1. Install PHP by running the following command:
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.

  1. Enable the Apache PHP module by running the following command:
sudo a2enmod php7.0
  1. Restart Apache to apply the changes:
sudo systemctl restart apache2
  1. Test the LAMP stack by creating a PHP file in the Apache root directory. Run the following command to create a new file called 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.

  1. Open a web browser and visit 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.

Created Time:2017-10-16 14:38:43  Author:lautturi