Here are some key commands used to complete the exercise shown in the below video
Connecting Cloud Storage with Cloud SQL in Google Cloud
apt-get update
apt-get install apache2 php php-mysql -y
service apache2 restart
gcloud storage buckets create -l $LOCATION
gs://$DEVSHELL_PROJECT_ID
Retrieve a banner image from a publicly accessible Cloud Storage location:
gcloud storage cp gs://cloud-training/gcpfci/my-excellent-blog.png my-excellent-blog.png
Copy the banner image to your newly created Cloud Storage bucket:
gcloud storage cp my-excellent-blog.png
gs://$DEVSHELL_PROJECT_ID/my-excellent-blog.png
gcloud storage cp my-excellent-blog.png gs://$DEVSHELL_PROJECT_ID/my-excellent-blog.png
gsutil acl ch -u allUsers:R gs://$DEVSHELL_PROJECT_ID/my-excellent-blog.png
cd /var/www/html
sudo nano index.php
index.php file
<html>
<head><title>Welcome to my excellent blog</title></head>
<body>
<h1>Welcome to my excellent blog</h1>
<?php
$dbserver = “CLOUDSQLIP”;
$dbuser = “blogdbuser”;
$dbpassword = “DBPASSWORD”;
$conn = new mysqli($dbserver, $dbuser, $dbpassword);
if (mysqli_connect_error()) {
echo (“Database connection failed: ” . mysqli_connect_error());
} else {
echo (“Database connection succeeded.”);
}
?>
</body></html>
Few more commands
sudo service apache2 restart
sudo nano index.php
sudo service apache2 restart
cd /var/www/html
sudo nano index.php
sudo service apache2 restart