How To install LAMP (Linux, Apache, MySQL, PHP) on Google Cloud Platform

To install LAMP (Linux, Apache, MySQL, PHP) on Google Cloud Platform, you can follow these steps:

  1. Create a new virtual machine (VM) instance on Google Cloud Platform using the Cloud Console.
  2. Connect to your VM instance using SSH.
  3. Install Apache web server by running the command: sudo apt-get install apache2
  4. Install MySQL by running the command: sudo apt-get install mysql-server
  5. Install PHP by running the command: sudo apt-get install php libapache2-mod-php
  6. configure Apache to use PHP by running the command: sudo nano /etc/apache2/mods-enabled/dir.conf
  7. move the PHP handler to the first line after the DirectoryIndex.

    The content of the dir.conf file should look something like this:




    To move the PHP handler to the first line after the DirectoryIndex, you should edit the file and change it to:

    <IfModule mod_dir.c>
        DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
    </IfModule>

  8. Restart Apache by running the command: sudo service apache2 restart
  9. To confirm that LAMP is installed and working correctly, you can create a PHP info file by running the command: sudo nano /var/www/html/info.php
  10. Add the following code to the file: <?php phpinfo(); ?>
  11. Save the file and exit the editor.
  12. Open a web browser and navigate to http://[your_instance_ip]/info.php
  13. you can set : sudo chmod -R 777 /var/www/html for ftp purpose

You should now see a page displaying information about your PHP installation. 


sudo chmod -R 777 /var/www/html


Comments

Popular posts from this blog