Run Laravel on Google Cloud Platform

Run Laravel on Google Cloud Platform


Laravel is one of the leading framework using by PHP Community. On the other hand, Google offers excellent more cost effective Cloud Platform by its own. But make to run your existing Laravel application maybe a nightmare if you didn’t follow these steps. I have tried a lot and finally found the solution, even you can run your Laravel 5.0 application also.


To access Google Cloud you should enable its billing with your valid credit card. Currently its coming with $300 free for 300 days :). Hope its ok for testing purpose. Little bit Unix Commands knowledge is preferable, but not must.

Few more steps

1. Create New Project in Google Cloud Platform.


2. Create App Engine Instance


3. Create Mysql Instance


Upload your files

There is 2 options to upload your files.

a. You can create a Bucket and upload your files

b. You can upload files directly to app engine storage. (we preferred this for easy access!)

First upload all of your files, I preferred to use Github or similiar Git Repos.

then clone it directly to Google App Engine from the Google Shell.



What is App.yaml


App.yaml is the configuration file which is used for App Engine Setting.



Launch Code Editor from Google Shell to access all the files and create a App.yaml on your project folder with the following lines.


READ  Share Values to all Controller & Views in Laravel

Connect with Mysql Database

As you know that we already created a mysql instance. In this step we just implement the credentials of our mysql database instance into the laravel app.  All we can do with the App.yaml

Activate API

This one is very important step and essential to run our application with mysql instance.



Settings for Laravel 5.0

All the above settings to make Laravel recent versions works as charm. But for Laravel 5.0,  We need some more tweaks to run.

1. Add PHP Version on your Composer.json


2. Add Line in Config/Database.php


3. Replace MysqlConnector file with the following (it will located on Vendor directory)

Thanks Gmergoil for this script.

READ  Android vs iOS a Technical Report


Deploy your application


Great! finally you got to run your Laravel application on Google Cloud.

Hope you enjoy the article! I would like to receive your suggestions & comments.

  • rickie94

    make a tutorial on Google container engine

Comments are closed.