Edit on GitHub
Report issue
Page history

Submitted by @{[ TutorialCtrl.tutorial.github_username ]} {[ TutorialCtrl.tutorial.date_published | date:'mediumDate' ]}

title: Run Symfony on Google App Engine Flexible Environment description: Learn how to deploy a Symfony app to Google App Engine flexible environment. author: bshaffer tags: App Engine, Symfony, PHP date_published: 2017-03-15


Symfony is a set of PHP Components, a Web Application framework, a Philosophy, and a Community — all working together in harmony.

– symfony.com

You can check out PHP on Google Cloud Platform to get an overview of PHP itself and learn ways to run PHP apps on Google Cloud Platform.


  1. Create a project in the Google Cloud Platform Console and make note of your project ID.
  2. Enable billing for your project.
  3. Install the Google Cloud SDK.


Follow the official documentation for installing symfony from symfony.com.


  1. Run the app with the following command:

    php bin/console server:run
  2. Visit http://localhost:8000 to see the Symfony Welcome page.


  1. Create an app.yaml file with the following contents:

    runtime: php
    env: flex
      document_root: web
  2. Create an nginx-app.conf file with the following contents:

    location / {
      # try to serve file directly, fallback to front controller
      try_files $uri /app.php$is_args$args;
  3. Add the following under "scripts" in composer.json:

    "post-deploy-cmd": [
        "chmod -R ug+w $APP_DIR/var"

    In the context of Symfony's composer.json, it will look like this:

    Add post-deploy-cmd scripts to composer.json

  4. Run the following command to deploy your app:

    gcloud app deploy
  5. Visit http://YOUR_PROJECT_ID.appspot.com to see the Symfony welcome page!

    Symfony welcome page

See more by @{[ TutorialCtrl.tutorial.github_username ]} and more tagged {[ tag ]}{[ $last ? '' : ', ' ]}

Submit a Tutorial

Share step-by-step guides


Request a Tutorial

Ask for community help


GCP Tutorials

Tutorials published by GCP


Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see our Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.