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:
- Create a new virtual machine (VM) instance on Google Cloud Platform using the Cloud Console.
- Connect to your VM instance using SSH.
- Install Apache web server by running the command: sudo apt-get install apache2
- Install MySQL by running the command: sudo apt-get install mysql-server
- Install PHP by running the command: sudo apt-get install php libapache2-mod-php
- configure Apache to use PHP by running the command: sudo nano /etc/apache2/mods-enabled/dir.conf
- 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> - Restart Apache by running the command: sudo service apache2 restart
- 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
- Add the following code to the file: <?php phpinfo(); ?>
- Save the file and exit the editor.
- Open a web browser and navigate to http://[your_instance_ip]/info.php
- 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
Post a Comment