title: How to deploy php project into google cloud using google app engine?
body: <p>I am new to this php development. I have developed a php web application using Netbeans 8.2 environment. I am trying to deploy the application but not running on server getting the error.</p>
  
  <p>As per googled instructions:</p>
  
  <ol>
  <li>Created google project on google cloud</li>
  <li>Downloaded google SDK and made some initial setup</li>
  <li>Generated app.yaml file into my project directory manually</li>
  <li>Deployed the project by using <code>gcloud app deploy</code> command on google sdk</li>
  </ol>
  
  <p>The app was not working not sure what is missing here.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>2018-01-11 17:15:05,223 DEBUG    root            Loaded Command Group: ['gcloud', 'app']
  2018-01-11 17:15:09,326 DEBUG    root            Loaded Command Group: ['gcloud', 'app', 'deploy']
  2018-01-11 17:15:09,332 DEBUG    root            Running [gcloud.app.deploy] with arguments: []
  2018-01-11 17:15:13,497 DEBUG    root            No staging command found for runtime [php] and environment [FLEX].
  2018-01-11 17:15:13,497 DEBUG    root            API endpoint: [https://appengine.googleapis.com/], API version: [v1]
  2018-01-11 17:15:16,911 INFO     ___FILE_ONLY___ Services to deploy:
  
  2018-01-11 17:15:16,913 INFO     ___FILE_ONLY___ descriptor:      [C:\xampp\htdocs\viralpermissionmodule\app.yaml]
  source:          [C:\xampp\htdocs\viralpermissionmodule]
  target project:  [permission-varal]
  target service:  [default]
  target version:  [20180111t171516]
  target url:      [https://permission-varal.appspot.com]
  
  2018-01-11 17:15:30,006 DEBUG    root            No bucket specified, retrieving default bucket.
  2018-01-11 17:15:30,105 DEBUG    root            Using bucket [gs://staging.permission-varal.appspot.com].
  2018-01-11 17:15:32,358 DEBUG    root            Service [appengineflex.googleapis.com] is already enabled for project [permission-varal]
  2018-01-11 17:15:32,757 INFO     ___FILE_ONLY___ Beginning deployment of service [default]...
  
  2018-01-11 17:15:32,759 INFO     root            Need Dockerfile to be generated for runtime php
  2018-01-11 17:15:32,759 INFO     ___FILE_ONLY___ Building and pushing image for service [default]
  
  2018-01-11 17:15:33,982 DEBUG    root            Could not call git with args ('config', '--get-regexp', 'remote\\.(.*)\\.url'): Command '['git', 'config', '--get-regexp', 'remote\\.(.*)\\.url']' returned non-zero exit status 1
  2018-01-11 17:15:33,982 INFO     root            Could not generate [source-contexts.json]: Could not list remote URLs from source directory: C:\xampp\htdocs\viralpermissionmodule
  Stackdriver Debugger may not be configured or enabled on this application. See https://cloud.google.com/debugger/ for more information.
  2018-01-11 17:15:40,645 INFO     root            Ignoring file [vendors\validator\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,650 INFO     root            Ignoring file [vendors\skycons\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,651 INFO     root            Ignoring file [vendors\select2\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,671 INFO     root            Ignoring file [vendors\select2\docs\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,723 INFO     root            Ignoring file [vendors\pnotify\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,779 INFO     root            Ignoring file [vendors\normalize-css\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,782 INFO     root            Ignoring file [vendors\morris.js\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,890 INFO     root            Ignoring file [vendors\jquery.easy-pie-chart\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,900 INFO     root            Ignoring file [vendors\jquery-knob\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,924 INFO     root            Ignoring file [vendors\ion.rangeSlider\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,963 INFO     root            Ignoring file [vendors\fontawesome\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,969 INFO     root            Ignoring file [vendors\font-awesome\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:40,980 INFO     root            Ignoring file [vendors\echarts\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:41,134 INFO     root            Ignoring file [vendors\autosize\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:41,138 INFO     root            Ignoring file [vendors\Flot\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:41,262 INFO     root            Ignoring file [vendors\Chart.js\.gitignore]: File matches ignore regex.
  2018-01-11 17:15:41,286 INFO     ___FILE_ONLY___ Some files were skipped. Pass `--verbosity=info` to see which ones.
  
  2018-01-11 17:15:41,286 INFO     ___FILE_ONLY___ You may also view the gcloud log file, found at
  [C:\Users\Divya\AppData\Roaming\gcloud\logs\2018.01.11\17.15.05.217000.log].
  
  2018-01-11 17:18:57,487 INFO     root            Uploading [c:\users\divya\appdata\local\temp\tmpoz4cq2\src.tgz] to [us.gcr.io/permission-varal/appengine/default.20180111t171516:latest]
  2018-01-11 17:34:02,029 DEBUG    root            Using runtime builder root [gs://runtime-builders/]
  2018-01-11 17:34:02,029 DEBUG    root            Loading runtimes manifest from [gs://runtime-builders/runtimes.yaml]
  2018-01-11 17:34:02,039 INFO     root            Reading [&lt;googlecloudsdk.api_lib.storage.storage_util.ObjectReference object at 0x000000000622A860&gt;]
  2018-01-11 17:34:02,983 DEBUG    root            Resolved runtime [php] as build configuration [gs://runtime-builders/php-default-builder-20180109142549.yaml]
  2018-01-11 17:34:02,984 INFO     root            Using runtime builder [gs://runtime-builders/php-default-builder-20180109142549.yaml]
  2018-01-11 17:34:03,140 INFO     root            Reading [&lt;googlecloudsdk.api_lib.storage.storage_util.ObjectReference object at 0x0000000007564F98&gt;]
  2018-01-11 17:34:06,464 INFO     ___FILE_ONLY___ Started cloud build [bcf17e78-6356-4a68-9baf-dec6cb0d265b].
  
  2018-01-11 17:34:06,484 DEBUG    root            GCS logfile url is https://www.googleapis.com/storage/v1/b/staging.permission-varal.appspot.com/o/log-bcf17e78-6356-4a68-9baf-dec6cb0d265b.txt?alt=media
  2018-01-11 17:34:06,484 INFO     ___FILE_ONLY___ To see logs in the Cloud Console: https://console.cloud.google.com/gcr/builds/bcf17e78-6356-4a68-9baf-dec6cb0d265b?project=permission-varal
  
  2018-01-11 17:34:07,753 DEBUG    root            Operation [operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi] not complete. Waiting 1s.
  2018-01-11 17:34:09,553 DEBUG    root            Reading GCS logfile: 404 (no log yet; keep polling)
  2018-01-11 17:34:10,867 DEBUG    root            Operation [operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi] not complete. Waiting 1s.
  2018-01-11 17:34:12,200 DEBUG    root            Reading GCS logfile: 404 (no log yet; keep polling)
  2018-01-11 17:34:13,448 DEBUG    root            Operation [operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi] not complete. Waiting 1s.
  2018-01-11 17:34:14,769 DEBUG    root            Reading GCS logfile: 404 (no log yet; keep polling)
  2018-01-11 17:34:16,022 DEBUG    root            Operation [operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi] not complete. Waiting 1s.
  2018-01-11 17:34:17,513 DEBUG    root            Reading GCS logfile: 404 (no log yet; keep polling)
  2018-01-11 17:34:18,765 DEBUG    root            Operation [operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi] not complete. Waiting 1s.
  2018-01-11 17:34:20,092 DEBUG    root            Reading GCS logfile: 404 (no log yet; keep polling)
  2018-01-11 17:34:21,397 DEBUG    root            Operation [operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi] not complete. Waiting 1s.
  2018-01-11 17:34:22,782 DEBUG    root            Reading GCS logfile: 404 (no log yet; keep polling)
  2018-01-11 17:34:24,046 DEBUG    root            Operation [operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi] not complete. Waiting 1s.
  2018-01-11 17:34:26,142 DEBUG    root            Reading GCS logfile: 206 (read 219 bytes)
  2018-01-11 17:34:26,194 INFO     ___FILE_ONLY___ ------------------------------------------------------------------------- REMOTE BUILD OUTPUT --------------------------------------------------------------------------
  
  2018-01-11 17:34:26,194 INFO     ___FILE_ONLY___ starting build "bcf17e78-6356-4a68-9baf-dec6cb0d265b"
  
  FETCHSOURCE
  Fetching storage object: gs://staging.permission-varal.appspot.com/us.gcr.io/permission-varal/appengine/default.20180111t171516:latest#1515672240520217
  
  2018-01-11 17:34:26,572 DEBUG    root            Operation [operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi] not complete. Waiting 1s.
  2018-01-11 17:34:28,384 DEBUG    root            Reading GCS logfile: 206 (read 383 bytes)
  2018-01-11 17:34:28,384 INFO     ___FILE_ONLY___ Copying gs://staging.permission-varal.appspot.com/us.gcr.io/permission-varal/appengine/default.20180111t171516:latest#1515672240520217...
  / [0 files][    0.0 B/ 21.4 MiB]                                                
  / [1 files][ 21.4 MiB/ 21.4 MiB]                                                
  
  Operation completed over 1 objects/21.4 MiB.                                     
  
  2018-01-11 17:34:29,625 DEBUG    root            Operation [operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi] not complete. Waiting 1s.
  2018-01-11 17:34:31,621 DEBUG    root            Reading GCS logfile: 206 (read 2108 bytes)
  2018-01-11 17:34:31,621 INFO     ___FILE_ONLY___ BUILD
  Starting Step #0
  Step #0: Pulling image: gcr.io/gcp-runtimes/php/gen-dockerfile@sha256:edf788ffa9988eaca2652d97da11fbcba70e6a47517a5e58234d67bfabb3d2a7
  Step #0: sha256:edf788ffa9988eaca2652d97da11fbcba70e6a47517a5e58234d67bfabb3d2a7: Pulling from gcp-runtimes/php/gen-dockerfile
  Step #0: Digest: sha256:edf788ffa9988eaca2652d97da11fbcba70e6a47517a5e58234d67bfabb3d2a7
  Step #0: Status: Downloaded newer image for gcr.io/gcp-runtimes/php/gen-dockerfile@sha256:edf788ffa9988eaca2652d97da11fbcba70e6a47517a5e58234d67bfabb3d2a7
  Step #0: + php /builder/create_dockerfile.php create --php72-image gcr.io/google-appengine/php72@sha256:7377baa6d86fce81a07799c0455617af18ea496483b668b8d7d8c129dfcef4f7 --php71-image gcr.io/google-appengine/php71@sha256:a1dc44d2dd59c4114f3e83f1acf6cccc19642aad970caf69f6424dbe93753485 --php70-image gcr.io/google-appengine/php70@sha256:cfe95f613eaa9790a626d5cc8d05c3ccc4aa3aa5d35d5147b131c6a210117b2a --php56-image gcr.io/google-appengine/php56@sha256:58d815fad2931c1029251dd4aebc78e0e4ff610ac1efe3f58da73f71dde7040d
  Step #0: 
  Step #0: There is no PHP runtime version specified in composer.json, or
  Step #0: we don't support the version you specified. Google App Engine
  Step #0: uses the latest 7.2.x version.
  Step #0: We recommend pinning your PHP version by running:
  Step #0: 
  Step #0: composer require php 7.2.* (replace it with your desired minor version)
  Step #0: 
  Step #0: Using PHP version 7.2.x...
  Step #0: 
  Step #0: 
  Step #0: In GenFilesCommand.php line 277:
  Step #0:                                                                             
  Step #0:   You have to set document_root in the runtime_config section in app.yaml.  
  Step #0:                                                                             
  Step #0: 
  Step #0: create [--php72-image PHP72-IMAGE] [--php71-image PHP71-IMAGE] [--php70-image PHP70-IMAGE] [--php56-image PHP56-IMAGE] [-w|--workspace WORKSPACE]
  Step #0: 
  Finished Step #0
  ERROR
  ERROR: build step 0 "gcr.io/gcp-runtimes/php/gen-dockerfile@sha256:edf788ffa9988eaca2652d97da11fbcba70e6a47517a5e58234d67bfabb3d2a7" failed: exit status 1
  
  2018-01-11 17:34:32,987 DEBUG    root            Operation [operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi] complete. Result: {
      "metadata": {
          "@type": "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOperationMetadata", 
          "build": {
              "finishTime": "2018-01-11T12:04:28.797248166Z", 
              "status": "FAILURE", 
              "timeout": "600s", 
              "startTime": "2018-01-11T12:04:05.278975440Z", 
              "logsBucket": "staging.permission-varal.appspot.com", 
              "results": {
                  "buildStepImages": [
                      "", 
                      ""
                  ]
              }, 
              "id": "bcf17e78-6356-4a68-9baf-dec6cb0d265b", 
              "timing": {
                  "FETCHSOURCE": {
                      "endTime": "2018-01-11T12:04:26.805854103Z", 
                      "startTime": "2018-01-11T12:04:22.656280394Z"
                  }, 
                  "BUILD": {
                      "endTime": "2018-01-11T12:04:28.275430314Z", 
                      "startTime": "2018-01-11T12:04:26.821453395Z"
                  }
              }, 
              "source": {
                  "storageSource": {
                      "object": "us.gcr.io/permission-varal/appengine/default.20180111t171516:latest", 
                      "bucket": "staging.permission-varal.appspot.com"
                  }
              }, 
              "options": {
                  "substitutionOption": "ALLOW_LOOSE"
              }, 
              "steps": [
                  {
                      "timing": {
                          "endTime": "2018-01-11T12:04:28.239822233Z", 
                          "startTime": "2018-01-11T12:04:26.821497421Z"
                      }, 
                      "args": [
                          "--php72-image", 
                          "gcr.io/google-appengine/php72@sha256:7377baa6d86fce81a07799c0455617af18ea496483b668b8d7d8c129dfcef4f7", 
                          "--php71-image", 
                          "gcr.io/google-appengine/php71@sha256:a1dc44d2dd59c4114f3e83f1acf6cccc19642aad970caf69f6424dbe93753485", 
                          "--php70-image", 
                          "gcr.io/google-appengine/php70@sha256:cfe95f613eaa9790a626d5cc8d05c3ccc4aa3aa5d35d5147b131c6a210117b2a", 
                          "--php56-image", 
                          "gcr.io/google-appengine/php56@sha256:58d815fad2931c1029251dd4aebc78e0e4ff610ac1efe3f58da73f71dde7040d"
                      ], 
                      "name": "gcr.io/gcp-runtimes/php/gen-dockerfile@sha256:edf788ffa9988eaca2652d97da11fbcba70e6a47517a5e58234d67bfabb3d2a7", 
                      "env": [
                          "GAE_APPLICATION_YAML_PATH=app.yaml"
                      ]
                  }, 
                  {
                      "args": [
                          "build", 
                          "-t", 
                          "us.gcr.io/permission-varal/appengine/default.20180111t171516:latest", 
                          "--network=cloudbuild", 
                          "."
                      ], 
                      "name": "gcr.io/cloud-builders/docker@sha256:bea5906142dbb335666c3512d65f2372553d2d93df018f86f69368c45d4205a7", 
                      "env": [
                          "GAE_APPLICATION_YAML_PATH=app.yaml"
                      ]
                  }
              ], 
              "sourceProvenance": {
                  "resolvedStorageSource": {
                      "generation": "1515672240520217", 
                      "object": "us.gcr.io/permission-varal/appengine/default.20180111t171516:latest", 
                      "bucket": "staging.permission-varal.appspot.com"
                  }, 
                  "fileHashes": {
                      "gs://staging.permission-varal.appspot.com/us.gcr.io/permission-varal/appengine/default.20180111t171516:latest#1515672240520217": {
                          "fileHash": [
                              {
                                  "type": "MD5", 
                                  "value": "6EqPrvIQES0E59lUklXmDA=="
                              }
                          ]
                      }
                  }
              }, 
              "projectId": "permission-varal", 
              "images": [
                  "us.gcr.io/permission-varal/appengine/default.20180111t171516:latest"
              ], 
              "substitutions": {
                  "_GAE_APPLICATION_YAML_PATH": "app.yaml", 
                  "_OUTPUT_IMAGE": "us.gcr.io/permission-varal/appengine/default.20180111t171516:latest"
              }, 
              "createTime": "2018-01-11T12:04:04.440340699Z", 
              "logUrl": "https://console.cloud.google.com/gcr/builds/bcf17e78-6356-4a68-9baf-dec6cb0d265b?project=permission-varal"
          }
      }, 
      "done": true, 
      "name": "operations/build/permission-varal/YmNmMTdlNzgtNjM1Ni00YTY4LTliYWYtZGVjNmNiMGQyNjVi", 
      "error": {
          "message": "Build failed; check build logs for details", 
          "code": 2
      }
  }
  2018-01-11 17:34:33,325 DEBUG    root            Reading GCS logfile: 416 (no new content; keep polling)
  2018-01-11 17:34:33,326 INFO     ___FILE_ONLY___ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  
  
  2018-01-11 17:34:33,368 DEBUG    root            (gcloud.app.deploy) Cloud build failed. Check logs at https://console.cloud.google.com/gcr/builds/bcf17e78-6356-4a68-9baf-dec6cb0d265b?project=permission-varal Failure status: UNKNOWN: Error Response: [2] Build failed; check build logs for details
  Traceback (most recent call last):
    File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 791, in Execute
      resources = calliope_command.Run(cli=self, args=args)
    File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 756, in Run
      resources = command_instance.Run(args)
    File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\app\deploy.py", line 65, in Run
      parallel_build=False)
    File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 587, in RunDeploy
      flex_image_build_option=flex_image_build_option)
    File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 377, in Deploy
      flex_image_build_option)
    File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 275, in _PossiblyBuildAndPush
      self.deploy_options.parallel_build)
    File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\app\deploy_command_util.py", line 442, in BuildAndPushDockerImage
      return _SubmitBuild(build, image, project, parallel_build)
    File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\app\deploy_command_util.py", line 474, in _SubmitBuild
      build, project=project)
    File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\cloudbuild\build.py", line 199, in ExecuteCloudBuild
      self.WaitAndStreamLogs(build_op)
    File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\cloudbuild\build.py", line 244, in WaitAndStreamLogs
      + message)
  BuildFailedError: Cloud build failed. Check logs at https://console.cloud.google.com/gcr/builds/bcf17e78-6356-4a68-9baf-dec6cb0d265b?project=permission-varal Failure status: UNKNOWN: Error Response: [2] Build failed; check build logs for details
  2018-01-11 17:34:33,664 ERROR    root            (gcloud.app.deploy) Cloud build failed. Check logs at https://console.cloud.google.com/gcr/builds/bcf17e78-6356-4a68-9baf-dec6cb0d265b?project=permission-varal Failure status: UNKNOWN: Error Response: [2] Build failed; check build logs for details
  2018-01-11 17:34:34,236 DEBUG    root            Metrics reporting process started...</code></pre>
  </div>
  </div>
  </p>
  
  <p>app.XAML FILE </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>env: flex
  runtime: php
  
  handlers:
  - url: /.*
    script: loginpage.php
    
  - url: /stylesheets
    static_dir: stylesheets
  
  - url: /(.*\.(gif|png|jpg))$
    static_files: static/\1
    upload: static/.*\.(gif|png|jpg)$
  
  - url: /.*
    script: not_found.php</code></pre>
  </div>
  </div>
  </p>
  
  <p>Below I have shared my running screen and app.yaml configuration set up and my project root details.please help me to deploy the project.</p>
  
  <p><a href="https://i.stack.imgur.com/dUH8L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dUH8L.png" alt="enter image description here"></a></p>