Custom Web & Mobile Apps Development Company Contact Us
Blog Home » Uncategorized » Run your App at Google App Engine using PHP

Run your App at Google App Engine using PHP

Run your App at Google App Engine using PHP
Reading Time: 3 minutes

Now, you can easily get PHP support on Google App Engine to enable you to run your app on GAE. In this article, we are going to explain the procedure to run your app on GAE.

We’ll mostly use PhpStorm here, because of its ability to support GAE’s projects in different ways; however, you are free to use any IDE you like.

Do you know the requirements of your platform? It is desired, because you need to locally run some software called Python, which is used to run the “server,” as it is the requirement of software development kit of Google’s App Engine.

There are alternative methods to download and install GAE plug-in, in case your PhpStorm application doesn’t include it. For this, you can search the plug-in browser in the “Preferences” option and use plug-in repositories to download and install it.

How to register an app on GAE?

In order to create your app, you can start by registering it and retrieving an application ID. You need to go to Google’s app engine website and login there with your Gmail account. Then, find the form and enter the desired information. For that, go to the dashboard, and click the button, “Create Application”.

How to Start?

Go to the drop-down menu, and select the new PHP project in GAE, and enter the desired information.
Two files will be created, as soon as you accept it, namely: main.php and app.yaml. Point to be noted here is that PhpStorm can be created, in case it is not being used by you.

The next step is to enter the information related to the Project Settings in your PhpStorm. Use your Gmail login details into the GAE for PHP.

How to test the application?

The “application” can be tested using these two methods.
1. Using the terminal to run it.
2. Using PhpStorm to run it.A. Using the terminal to run it

Enter the following code to run it from the terminal:

This is how you can run the application server. It will result into two more activities:
1. At http://localhost:8000, you’d be able to run an admin console.
2. At http://localhost:8080, the app would run itself. You can find a lot of significant information, inside the admin console.

In the browser, you would be able to see “Hello World”, while pointing it at http://localhost:8080
While running the app, you may get an error code similar to, “the path specified…. does not exist”, which indicates that the location of php-cgi is not known to the app server and therefore, it is unable to run it. In such a case, you can enter the following string to execute it:

You can easily find the location of your php-cgi by typing “whereis php-cgi”; it would show where it is lying in the terminal.

How to run the app from PhpStorm?

To do it, Go to “Select Run/Debug Configuration” menu and edit configurations from there.
While, most of the details would already be there in the pop-up, “Path to php-cgi…” might be missing, which can be found by typing “whereis…”.
After this , do the following: click Apply>OK>
Go to the “Select Run~Debug Configuration” menu and find a green arrow in front of it. Entire information about the server would then be displayed by the The PhpStorm console and, you would also be able to access both the local hosts, i.e. 8000 and 8080. The second host 8080, would display the desired output inside the browser.
It enables you to debug step-by-step and set breakpoints. Go to the editor window, and hit a line number given in the code; it would display a red ball, which is known as a breakpoint. During the course of your app being run, the server pauses when it reaches the breakpoint. It facilitates inspecting various variables including memory used etc.

How to deploy it?

You can deploy the application to the Google Engine using the following three methods:
1) Using the command /terminal line
2) Using the PhpStorm
3) Using the Git

How to deploy it through terminal?

This process is similar to calling google_A1/appcfg.py G01/

How to deploy it through PhpStorm?

Use the following process to deploy to PhpStorm: click tools>GAE for PHP> upload GAE PHP app.
This process executes smoothly without any interruptions, if the desired information is already been entered in the project settings.

How to deploy it through Git?

Deploying GIT is an optional feature of App engine.

Conclusion

You can deploy highly effective and measurable applications on GAE, which will bring you good traffic as well. Even the free quotas can fetch you millions of views per month and it is easily measurable too.
[Note: The bold values in the command lines have to be replaced by the suggested values in the brackets above.]

Varun Bhagat is a technology geek and works in PixelCrayons as a Sr. Technology Consultant. He possesses in-depth knowledge of different web development technology and helps our clients to choose the best technology as per their needs.

Are you ready to turn your idea into reality? Contact Us Now