Running PHP app in Google App Engine Flexible Environment gcloud app deploy failed, But local working fine

1,386 views
Skip to first unread message

Dhandapani Sattanathan

unread,
Sep 28, 2016, 5:58:54 AM9/28/16
to Google App Engine, SOMAYA SARATHBABOU

I want to use Google App engine FE to run PHP app.


I tried the sample hello world as per the  below link

https://cloud.google.com/php/getting-started/hello-world


1. I tried the following steps in my local



1.Created a project in Cloud Platform Console.

2.Under App Engine location, selected a United States location.

3. Gave project name as ‘ TEST-FE.

4. Installed Google Cloud SDK


Using Google Cloud SDK  , Steps i did.



Welcome to the Google Cloud SDK! Run "gcloud -h" to get the list of available commands.

C
:\Program Files (x86)\Google\Cloud SDK>cd /..



09/27/2016  05:22 PM    <DIR>          appengine-custom-runtimes-samples

09/28/2016  10:30 AM    <DIR>          getting-started-php


C
:\>cd getting-started-php


C
:\getting-started-php>dir

Directory of C:\getting-started-php


09/28/2016  10:30 AM    <DIR>          .

09/28/2016  10:30 AM    <DIR>          ..

09/28/2016  10:30 AM               474 .coveralls.yml

09/28/2016  10:30 AM               137 .gitignore

09/28/2016  10:30 AM             1,343 .travis.yml

09/28/2016  10:30 AM    <DIR>          1-hello-world

09/28/2016  10:30 AM    <DIR>          2-structured-data

09/28/2016  10:30 AM    <DIR>          3-cloud-storage

09/28/2016  10:30 AM    <DIR>          4-auth

09/28/2016  10:30 AM    <DIR>          5-logging

09/28/2016  10:30 AM    <DIR>          6-pubsub

09/28/2016  10:30 AM             1,661 CONTRIBUTING.md

09/28/2016  10:30 AM            11,558 LICENSE

09/28/2016  10:30 AM    <DIR>          optional-compute-engine

09/28/2016  10:30 AM    <DIR>          optional-container-engine

09/28/2016  10:30 AM             2,527 README.md

09/28/2016  10:30 AM    <DIR>          testing

09/28/2016  10:30 AM             1,676 TRAVIS.md

09/28/2016  10:30 AM    <DIR>          _tuts

               
7 File(s)         19,376 bytes

             
12 Dir(s)  816,290,033,664 bytes free

C
:\getting-started-php>cd 1-hello-world

C
:\getting-started-php\1-hello-world>composer install

Loading composer repositories with package information

Installing dependencies (including require-dev) from lock file

 
- Installing symfony/routing (v3.0.2)

   
Downloading: 100%

 
- Installing symfony/http-foundation (v3.0.2)

   
Downloading: 100%

 
- Installing symfony/event-dispatcher (v3.0.2)

   
Downloading: 100%

 
- Installing psr/log (1.0.0)

   
Downloading: 100%

 
- Installing symfony/debug (v3.0.2)

   
Downloading: 100%




 
- Installing symfony/http-kernel (v3.0.2)

   
Downloading: 100%
 
- Installing pimple/pimple (v1.1.1)

   
Downloading: 100%

 
- Installing silex/silex (v1.3.5)

   
Downloading: 100%

 
- Installing symfony/polyfill-mbstring (v1.1.0)

   
Downloading: 100%

 
- Installing symfony/dom-crawler (v3.0.2)

   
Downloading: 100%

 
- Installing symfony/css-selector (v2.8.2)

   
Downloading: 100%

 
- Installing symfony/browser-kit (v3.0.2)

   
Downloading: 100%

 
- Installing psr/http-message (1.0)

   
Downloading: 100%

 
- Installing guzzlehttp/psr7 (1.2.2)

   
Downloading: 100%

 
- Installing guzzlehttp/promises (1.0.3)

   
Downloading: 100%

 
- Installing guzzlehttp/guzzle (6.1.1)

   
Downloading: 100%

 
- Installing fabpot/goutte (v3.1.2)

   
Downloading: 100%

 
- Installing behat/mink (v1.7.0)

   
Downloading: 100%

 
- Installing behat/mink-browserkit-driver (v1.3.1)

   
Downloading: 100%

 
- Installing behat/mink-goutte-driver (v1.2.0)

   
Downloading: 100%

 
- Installing phpdocumentor/reflection-docblock (2.0.4)

   
Downloading: 100%

 
- Installing phpunit/php-token-stream (1.4.8)

   
Downloading: Failed

   
Downloading: 100%

 
- Installing symfony/yaml (v3.0.2)

   
Downloading: 100%


 
- Installing sebastian/version (1.0.6)

   
Downloading: 100%

 
- Installing sebastian/global-state (1.1.1)

   
Downloading: 100%




 
- Installing sebastian/recursion-context (1.0.2)

   
Downloading: 100%




 
- Installing sebastian/exporter (1.2.1)

   
Downloading: 100%




 
- Installing sebastian/environment (1.3.3)

   
Downloading: 100%




 
- Installing sebastian/diff (1.4.1)

   
Downloading: 100%




 
- Installing sebastian/comparator (1.2.0)

   
Downloading: 100%




 
- Installing phpunit/php-text-template (1.2.1)

   
Downloading: 100%




 
- Installing doctrine/instantiator (1.0.5)

   
Downloading: 100%




 
- Installing phpunit/phpunit-mock-objects (2.3.8)

   
Downloading: 100%




 
- Installing phpunit/php-timer (1.0.7)

   
Downloading: 100%




 
- Installing phpunit/php-file-iterator (1.4.1)

   
Downloading: 100%




 
- Installing phpunit/php-code-coverage (2.2.4)

   
Downloading: 100%




 
- Installing phpspec/prophecy (v1.5.0)

   
Downloading: 100%




 
- Installing phpunit/phpunit (4.8.22)

   
Downloading: 100%




symfony
/routing suggests installing doctrine/annotations (For using the annotation loader)

symfony
/routing suggests installing symfony/config (For using the all-in-one router or any loader)

symfony
/routing suggests installing symfony/dependency-injection (For loading routes from a service)

symfony
/routing suggests installing symfony/expression-language (For using expression matching)

symfony
/event-dispatcher suggests installing symfony/dependency-injection ()

symfony
/http-kernel suggests installing symfony/class-loader ()

symfony
/http-kernel suggests installing symfony/config ()

symfony
/http-kernel suggests installing symfony/console ()

symfony
/http-kernel suggests installing symfony/dependency-injection ()

symfony
/http-kernel suggests installing symfony/finder ()

symfony
/http-kernel suggests installing symfony/var-dumper ()

symfony
/browser-kit suggests installing symfony/process ()

behat
/mink suggests installing behat/mink-selenium2-driver (slow, but JS-enabled driver for any app (requires Selenium2))

behat
/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))

phpdocumentor
/reflection-docblock suggests installing dflydev/markdown (~1.0)

phpdocumentor
/reflection-docblock suggests installing erusev/parsedown (~1.0)

sebastian
/global-state suggests installing ext-uopz (*)

phpunit
/phpunit-mock-objects suggests installing ext-soap (*)

phpunit
/php-code-coverage suggests installing ext-xdebug (>=2.2.1)

phpunit
/phpunit suggests installing phpunit/php-invoker (~1.1)

Generating autoload files


C
:\getting-started-php\1-hello-world>php -S localhost:8000 -t web

PHP
7.0.6 Development Server started at Wed Sep 28 11:23:48 2016

Listening on http://localhost:8000

Document root is C:\getting-started-php\1-hello-world\web

Press Ctrl-C to quit.


I got the o/p in my browser


In my local Working fine.


2. I want to use in my GOOGLE CLOUD PLATFORM.


I tried to deploy the app. Plz refer the below steps


C:\getting-started-php\1-hello-world>gcloud app deploy

You are about to deploy the following services:

 
- TEST-FE/default/20160928t122113 (from [C:\getting-started-php\1-hello-world\app.yaml])

     
Deployed URL: [https://TEST-FE.appspot.com]

Do you want to continue (Y/n)?  Y


Beginning deployment of service [default]...

WARNING
: Deployment of App Engine Flexible Environment apps is currently in Beta

Building and pushing image for service [default]

Started cloud build [fba82e90-97bf-45da-bb42-04d7f084bd26].

To see logs in the Cloud Console: https://console.developers.google.com/logs?project=TEST-FE&service=cloudbuild.googleapis.com&key1=fba82e90-97bf-45da-bb42-04d7f084bd26

------------------------------------------------------------------------------------------------------------------------- REMOTE BUILD OUTPUT -------------------------------------------------------------------------------------------------------------------------

starting build
"fba82e90-9bf-45da-bb42-0084bd26"


FETCHSOURCE

Fetching storage object: gs://staging.TEST-FE.appspot.com/us.gcr.io/TEST-FE/appengine/default.20160928t122113:latest#1475045513256000

Copying gs://staging.TEST-FE.appspot.com/us.gcr.io/TEST-FE/appengine/default.20160928t122113:latest#14750000...

Downloading file:///tmp/source-archive.tgz:                      1.7 MiB/1.7 MiB

BUILD

Already have image (with digest): gcr.io/cloud-builders/docker

Sending build context to Docker daemon 10.76 MB

Step 1 : FROM gcr.io/google_appengine/php:latest

[91m# Executing 3 build triggers...

[0mStep 1 : COPY . $APP_DIR

Step 1 : RUN chown -R www-data.www-data $APP_DIR

 
---> Running in 08fa5c0d06b6

Step 1 : RUN /composer.sh

 
---> Running in 76e2b2b81892

[91m+ DEFAULT_PHP_VERSION=5.6

[0m[91m+ '[' -f /app/composer.json ']'

[0m[91m+ CMD='php /tmp/detect_php_version.php /app/composer.json'

[0m[91m++ su www-data -c 'php /tmp/detect_php_version.php /app/composer.json'

[0m[91m+ PHP_VERSION=5.6

[0m[91m+ rm -rf /tmp/vendor /tmp/detect_php_version.php /tmp/composer.json /tmp/composer.lock

[0m[91m+ '[' 5.6 '!=' 7.0 ']'

[0m[91m+ '[' 5.6 '!=' 5.6 ']'

[0m[91m+ '[' 5.6 == 7.0 ']'

[0m[91m+ '[' 5.6 == 5.6 ']'

[0m[91m+ rm /opt/php

[0m[91m+ ln -sf /opt/php56 /opt/php

[0m[91m+ COMPOSER_GITHUB_OAUTH_TOKEN=

[0m[91m+ [[ -n '' ]]

[0m[91m+ unset COMPOSER_GITHUB_OAUTH_TOKEN

[0m[91m+ rm -rf /app/vendor

[0m[91m+ cd /app

[0m[91m+ su www-data -c 'php /usr/local/bin/composer           install           --no-scripts           --no-dev           --prefer-dist           --optimize-autoloader           --no-interaction           --no-ansi           --no-progress'

[0m[91mLoading composer repositories with package information[0m[91m

[0m[91mInstalling dependencies from lock file[0m[91m

[0m[91m  - Installing symfony/routing (v3.0.2)[0m[91m

[0m[91m    Downloading[0m[91m

[0m[91m

[0m[91m  - Installing symfony/http-foundation (v3.0.2)[0m[91m

[0m[91m    Downloading[0m[91m

[0m[91m

[0m[91m  - Installing symfony/event-dispatcher (v3.0.2)[0m[91m

[0m[91m    Downloading[0m[91m

[0m[91m

[0m[91m  - Installing psr/log (1.0.0)[0m[91m

[0m[91m    Downloading[0m[91m

[0m[91m

[0m[91m  - Installing symfony/debug (v3.0.2)[0m[91m

[0m[91m    Downloading[0m[91m

[0m[91m

[0m[91m  - Installing symfony/http-kernel (v3.0.2)[0m[91m

[0m[91m    Downloading[0m[91m

[0m[91m

[0m[91m  - Installing pimple/pimple (v1.1.1)[0m[91m

[0m[91m    Downloading[0m[91m

[0m[91m

[0m[91m  - Installing silex/silex (v1.3.5)[0m[91m

[0m[91m    Downloading[0m[91m

[0m[91m

[0m[91mGenerating optimized autoload files

[0m ---> 7b6427427a6b

Removing intermediate container 3bb0978e11dc

Removing intermediate container 08fa5c0d06b6

Removing intermediate container 76e2b2b81892

Step 2 : ENV DOCUMENT_ROOT \app\web

 
---> Running in 36b3ebb1f3c9

 
---> 94af3b8f06ac

Removing intermediate container 36b3ebb1f3c9

Successfully built 94af3b8f06ac

PUSH

The push refers to a repository [us.gcr.io/TEST-FE/appengine/default.20160928t122113] (len: 1)

94af3b8f06ac: Preparing

94af3b8f06ac: Pushing

94af3b8f06ac: Pushed

7b6427427a6b: Preparing

7b6427427a6b: Pushing

7b6427427a6b: Pushed

03bbccfac6c9: Preparing

03bbccfac6c9: Pushing

03bbccfac6c9: Pushed

70a9dd0a3364: Preparing

70a9dd0a3364: Pushing

70a9dd0a3364: Pushed

d7062244e3ce
: Image already exists

d77beb96da56
: Image already exists

78a079da7004: Image already exists

8c62b0d207b6: Image already exists

131b27e44397: Image already exists

e3a2a0b617f7
: Image already exists

03041c16774a: Image already exists

36b3ede8f830: Image already exists

357e7325b452: Image already exists

1ccaa2f3c455: Image already exists

e9302f5346fb
: Image already exists

671ef044f743: Image already exists

947b42844e3c: Image already exists

9c7c106b33c1: Image already exists

f2895e0a6f40
: Image already exists

02490d5b2719: Image already exists

c113cb0d7613
: Image already exists

9b6060b0bc62: Image already exists

8bdfd4b37788: Image already exists

b21b3e3bc691
: Image already exists

latest
: digest: sha256:3993656b7e1fc32c958f602aa4bc990cc171266efa1db20a9bc592df18baecc1 size: 86760

DONE

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                                                                                                                                                                                                                                                               
Updating service [default]...-    




Updating service [default]...failed.


ERROR
: (gcloud.app.deploy) Error Response: [13] Timed out when starting VMs.  It's possible that the application code is unhealthy.  (0/2 ready, 2 still deploying).



Plz help me. What i did wrong in deploying php in google flexible environment.



Dhandapani Sattanathan

unread,
Sep 28, 2016, 8:02:48 AM9/28/16
to Google App Engine, sarathbab...@ssomens.com
I want to install PHP 7 IN GAE.

https://github.com/GoogleCloudPlatform/php-docker/tree/master/php-nginx#change-the-php-version

using this above link i changed. Is this correct? Or Any other way to install PHP 7 IN GAE ?

Plz help me to solve this!.

Thanks in advance

Dhandapani Sattanathan

unread,
Oct 5, 2016, 1:12:08 AM10/5/16
to Google App Engine, sarathbab...@ssomens.com
Plz help me to solve this.

Thanks in Advance

Dhandapani Sattanathan

unread,
Oct 13, 2016, 6:24:00 AM10/13/16
to Google App Engine, sarathbab...@ssomens.com

GAE Team,

I m  getting  While deploying PHP App in GAE Flexible Environment

ERROR: (gcloud.app.deploy) Error Response: [13] Timed out when starting VMs.  It's possible that the application code is unhealthy.  (0/2 ready, 2 still deploying).

Plz help me to solve this.

Somaya Sarathbabou

unread,
Oct 17, 2016, 12:40:53 AM10/17/16
to Google App Engine, sarathbab...@ssomens.com
Hello Nick or other GAE support team,
                                                          Should we consider this non response for such a long time, that noone cares about the Google App Engine Flexible Environment.
I just cant understand then if nooone could reply us, how to go forward and use Google Services?

Plz can you guys be a bit reactive on this and reply us?
Is it bad/unlucky for us to try your new GAE FE, if so plz let us know that you cant support anymore or not willing to support, we ll discontinue using all services related to GAE.

I am just shocked.

Thanks,

Somaya Sarathbabou

unread,
Nov 3, 2016, 8:48:31 AM11/3/16
to Google App Engine, sarathbab...@ssomens.com
Any updates?

Nick (Cloud Platform Support)

unread,
Jan 17, 2017, 11:44:31 AM1/17/17
to Google App Engine, sarathbab...@ssomens.com
Hey Somaya and Dhandapani,

This post had somehow escaped our notice. I've just replied in quite some detail to another thread about running a PHP 7 app in the Flexible Environment in another thread which Dhandapani is also commenting in, so be sure to check that in addition to reading this response.

It seems that the unique question of this thread, apart from how to run a PHP 7 container app generally (nginx is recommended rather than using the PHP development server), is the question of what is going wrong in this build.

It seems to me that there is no line in the Dockerfile which would actually run a web server program (whether nginx or the PHP -S development server, in fact). This is likely why the application is not considered healthy by the infrastructure, which will send health-check requests to the instance at /_ah/health, expecting a 200 OK response, or else the instance is considered unhealthy and will either not start or be killed.

In fact, there's another issue in that what appears to be a one-time script that should be run via the Dockerfile "RUN" directive is being run via "CMD", which probably doesn't do what you're thinking it does. The "CMD" directive tells the container which program to run when it boots up, and is generally used to run the server program (nginx, a particular java class, nodeJS, the PHP -S command (although being a development server this is not advised), etc.).

See the following extract from the Dockerfile "CMD" directive documentation:

The CMD instruction has three forms:

        • CMD ["executable","param1","param2"] (exec form, this is the preferred form)
        • CMD ["param1","param2"] (as default parameters to ENTRYPOINT)
        • CMD command param1 param2 (shell form)

There can only be one CMD instruction in a Dockerfile. If you list more than one CMD then only the last CMD will take effect.

The main purpose of a CMD is to provide defaults for an executing container. These defaults can include an executable, or they can omit the executable, in which case you must specify an ENTRYPOINTinstruction as well.


In addition to defining a proper "CMD" line to run whichever web server program you want to use, you should change the CMD line you have as follows:

-- CMD='php /tmp/detect_php_version.php /app/composer.json'
++ RUN php /tmp/detect_php_version.php /app/composer.json

Let me know if all of this helps, and we can continue to discuss if there are any further questions.

Cheers,

Nick
Cloud Platform Community Support

Samuel Chukwuemeka

unread,
Jul 17, 2017, 8:26:11 AM7/17/17
to Google App Engine, sarathbab...@ssomens.com
Dhandapani,

        Has your issue been resolved?

If not, I did a YouTube video (https://www.youtube.com/watch?v=63LrFMuLS8E) that shows the steps to download, install, and configure gcloud; as well as use the gcloud to deploy php web apps.

Thank you.


Samuel

SN

unread,
Jul 18, 2017, 12:49:43 AM7/18/17
to google-a...@googlegroups.com, SOMAYA SARATHBABOU
Hi Samuel,

Thanks for your reply. I solved my issues, also updated in another posting.plz refer this https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/google-appengine/-LBNYHaT_Yw/I2Q1WSUdCQAJ

You did a very good job!.


Regards,

SATTANATHAN D
PROJECT MANAGER

SSOMENS SOFTWARE DEVELOPMENT
04132333229 /230/231
C:\Users\SSOMENS-003_2\Desktop\business development material\customLogo.gif.png
Education is the most powerful weapon which you can use to change the world

--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/zLOy6F-HnGc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/d8d87852-1ac3-4d15-9b41-8cddfb63966e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages