App Engine locations

App Engine is regional, which means the infrastructure that runs your apps is
located in a specific region and is managed by Google to be redundantly
available across all the zones within that
region.

Meeting your latency, availability, or durability requirements are primary
factors for selecting the region where your apps are run. You can generally
select the region nearest to your app's users but you should consider the
location of the other Cloud Platform products and
services that are utilized by your app. Using
services across multiple locations can affect your app's latency as well as
pricing.

App Engine is available in the following regions:

us-central1

us-east1

us-east4

southamerica-east1 *

europe-west1

europe-west2

europe-west3

asia-northeast1

australia-southeast1

* For customers using the São Paulo region, all regional product SLAs will
remain in force. However, multi-region and cross-region functionality
spanning North America and South America may temporarily have reduced
availability or performance.

Download the Hello World app

We've created a simple Hello World app for PHP so you can quickly get a feel
for deploying an app to Google Cloud Platform. Follow these steps to download
Hello World to your local machine.

Clone the Hello World sample app repository to your local machine in a
directory called helloworld:

Note: The Windows and Mac SDKs are bundled with a specific version of PHP to
emulate the App Engine environment. If you're on Linux, or would like to use a
different version of PHP, read these
instructions first.

Running the local development server (dev_appserver.py)

To run the local development server, you can either run dev_appserver.py by
specifying the full directory path or you can add dev_appserver.py to your
PATH environment variable:

If you installed the original App Engine SDK, the tool is located at:

[PATH_TO_APP_ENGINE_SDK]/dev_appserver.py

If you installed the Google Cloud SDK, the tool is located at:

[PATH_TO_CLOUD_SDK]/google-cloud-sdk/bin/dev_appserver.py

Tip: To add the Google Cloud SDK tools to your PATH environment variable
and enable command-completion in your shell, you can run:

[PATH_TO_CLOUD_SDK]/google-cloud-sdk/install.sh

For more information about running the local development server including how
to change the port number, see the Local Development
Server reference.

Make a change

You can leave the development server running while you develop your application.
The development server watches for changes in your project files, and
reloads them if necessary.

Try it now: Leave the development server running, then edit helloworld.php
to change Hello, World! to something else.

Clean up

To avoid incurring charges, you can delete your Cloud Platform project to stop
billing for all the resources used within that project.
Warning: Deleting a project has the following
consequences:

If you used an existing project, you'll also delete
any other work you've done in the project.

You can't reuse the project ID of a deleted project.
If you created a custom project ID that you plan to use in
the future, you should delete the resources inside the project
instead. This ensures that URLs that use the project ID, such
as an appspot.com URL, remain available.

In the project list, select the project you
want to delete and click Delete project.

In the dialog, type the project ID, and then click
Shut down to delete the project.

What's next

Use a custom domain

You can serve your App Engine app using your own custom domain instead of
appspot.com. For more information, see Using Custom Domains and
SSL.

Hello World code review

Hello World is the simplest possible App Engine app: it contains only one
service, has only one version, and all of the code is located within the app's
root directory. This section describes each of the app files in detail.

helloworld.php

The helloworld.php script responds to any HTTP request with the message
Hello, World!.

app.yaml

From top to bottom, this configuration file says the following about this
application:

This code runs in the php55 runtime environment, API version 1.

This application is threadsafe so the same instance can handle several
simultaneous requests. Threadsafe is an advanced feature and can result in
erratic behavior if your application is not specifically designed to be
threadsafe.

Every request to a URL whose path matches the regular expression /.*
(all URLs) should be handled by the helloworld.php script.

Troubleshooting

The following is a common error message that you might encounter:

The development server must be started with the --php_executable_path flag set to the path of the php-cgi binary.

If you encounter this error when running dev_appserver.py, you need to rerun
dev_appserver.py with the flag php_executable_path and specify the path to
your php-cgi binary. On Linux and Mac systems, you can find the path by
running the following command:

which php

Example of the dev_appserver.py command with the --php_executable_path
flag set to the /usr/bin/php-cgi path:

dev_appserver.py helloworld/ --php_executable_path /usr/bin/php-cgi

Learn more

Learn the whole platform

Now that you know what it's like to develop and deploy App Engine apps, you can
stretch out and see the rest of Google Cloud Platform. For a guided walkthrough
that teaches you how to create an application that uses the entire platform,
not just App Engine, check out our Creating a Guestbook
tutorial in which you expand this simple application to become a
fully-fledged Guestbook application that lets authenticated Google accounts
post messages to a public page.