Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Deploy !
a PHP Application!
on Google App Engine
Who am I?
Michele Orselli!
CTO@Ideato!
!
@_orso_!
mo@ideato.it
Titolo Testo
PHP for App Engine
https://developers.google.com/events/io/sessions/333055646
The GAE platform
Platform as A Service (PaaS)!
Build, deploy & scale!
Don’t care about infrastructure
https://appengine.go...
Google App Engine: services
All PaaS have limitations!
PHP is in preview phase!
Not all services are available
https://dev...
Google App Engine: data storage
Google Cloud Sql !
Memcache!
Google Cloud Storage
Google App Engine: ext services
Email (internal or SendGrid)!
Twilio!
UrlFetch
Google App Engine: offline work
TaskQueue!
Cron
Google App Engine: auth
User Auth!
Application Identity
Titolo Testo
PHP on GAE
PHP 5.4!
Runs in a sandbox
https://developers.google.com/appengine/docs/php/
PHP on GAE
Some well-know extension are
disabled: imagick, intl, pcntl, curl
PHP on GAE
Some well-know extension are
disabled: imagick, intl, pcntl, curl
PHP on GAE
whaaat?
Some function are disabled!
permanently: exec, tmpfile!
partially: /e on preg_replace!
softly: gc_*, parse_str
PHP on GAE
File System is Read only: you can
store files on Cloud Storage or
external services
PHP on GAE
PHP on GAE
Cannot invoke external services
directly (no curl remember? :-P)
PHP on GAE
PHP on GAE
Dynamic response max 32 MB!
Timeout on long response
PHP on GAE
Sessions are stored on Memcache !
session_*, $_SESSION work as expected!
use session_set_save_handler to change
handler
PH...
Log are managed via syslog!
use syslog function!
use custom logging lib (eg. Monolog)
PHP on GAE
PHP on GAE
get the sdk!
requirements: python 2.7, php-cgi, mysql?!
local web server
wget https://storage.googleapis.com/appengine-sdk...
# app.yaml	

application: propane-forge-391	

version: 1	

runtime: php	

api_version: 1	

threadsafe: true	

Base Config
# app.yaml	

application: propane-forge-391	

version: 2	

runtime: php	

api_version: 1	

threadsafe: true	

Base Config
# app.yaml — continued	

handlers:	

- url: /css	

static_dir: web/css	

- url: /js	

static_dir: web/js	

- url: .*	

scr...
# php.ini	

google_app_engine.enable_functions = “…”	

Base Config
!
dev_appserver.py --php_executable_path=/usr/bin/php-cgi /
var/www/todo/	

Test Locally
Deploy
!
appcgf.py update /var/www/todo/!
(or git push)
show me the code!
https://github.com/ideatosrl/silex-todo-gae
That’s all folks
Thank you!
@_orso_ mo@ideato.it
Upcoming SlideShare
Loading in …5
×

Deploy a php app on Google App Engine

1,965 views

Published on

PHP was added to the languages offered by Google App Engine about a year ago. This session will focus on porting an existing app on gae.

We’ll start talking about the main characteristics of the app engine platform, which kind of services are available (persistence, storage, queue and so on) and how to use it. Then the PHP installation of app engine will be discussed, highlighting implementation choices and limitations.

The second part of the talk will go into implementation details in particular about what tweaks are needed to run an existing app on gae e.g: how session is managed, logging is performed and how to interact with the file system not forgetting about deploy

  • Be the first to comment

Deploy a php app on Google App Engine

  1. 1. Deploy ! a PHP Application! on Google App Engine
  2. 2. Who am I? Michele Orselli! CTO@Ideato! ! @_orso_! mo@ideato.it
  3. 3. Titolo Testo PHP for App Engine https://developers.google.com/events/io/sessions/333055646
  4. 4. The GAE platform Platform as A Service (PaaS)! Build, deploy & scale! Don’t care about infrastructure https://appengine.google.com/ https://developers.google.com/appengine/
  5. 5. Google App Engine: services All PaaS have limitations! PHP is in preview phase! Not all services are available https://developers.google.com/appengine/features
  6. 6. Google App Engine: data storage Google Cloud Sql ! Memcache! Google Cloud Storage
  7. 7. Google App Engine: ext services Email (internal or SendGrid)! Twilio! UrlFetch
  8. 8. Google App Engine: offline work TaskQueue! Cron
  9. 9. Google App Engine: auth User Auth! Application Identity
  10. 10. Titolo Testo PHP on GAE
  11. 11. PHP 5.4! Runs in a sandbox https://developers.google.com/appengine/docs/php/ PHP on GAE
  12. 12. Some well-know extension are disabled: imagick, intl, pcntl, curl PHP on GAE
  13. 13. Some well-know extension are disabled: imagick, intl, pcntl, curl PHP on GAE whaaat?
  14. 14. Some function are disabled! permanently: exec, tmpfile! partially: /e on preg_replace! softly: gc_*, parse_str PHP on GAE
  15. 15. File System is Read only: you can store files on Cloud Storage or external services PHP on GAE
  16. 16. PHP on GAE
  17. 17. Cannot invoke external services directly (no curl remember? :-P) PHP on GAE
  18. 18. PHP on GAE
  19. 19. Dynamic response max 32 MB! Timeout on long response PHP on GAE
  20. 20. Sessions are stored on Memcache ! session_*, $_SESSION work as expected! use session_set_save_handler to change handler PHP on GAE
  21. 21. Log are managed via syslog! use syslog function! use custom logging lib (eg. Monolog) PHP on GAE
  22. 22. PHP on GAE
  23. 23. get the sdk! requirements: python 2.7, php-cgi, mysql?! local web server wget https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.4.zip App Engine SDK
  24. 24. # app.yaml application: propane-forge-391 version: 1 runtime: php api_version: 1 threadsafe: true Base Config
  25. 25. # app.yaml application: propane-forge-391 version: 2 runtime: php api_version: 1 threadsafe: true Base Config
  26. 26. # app.yaml — continued handlers: - url: /css static_dir: web/css - url: /js static_dir: web/js - url: .* script: web/index.php Base Config
  27. 27. # php.ini google_app_engine.enable_functions = “…” Base Config
  28. 28. ! dev_appserver.py --php_executable_path=/usr/bin/php-cgi / var/www/todo/ Test Locally
  29. 29. Deploy ! appcgf.py update /var/www/todo/! (or git push)
  30. 30. show me the code! https://github.com/ideatosrl/silex-todo-gae
  31. 31. That’s all folks Thank you! @_orso_ mo@ideato.it

×