Transcript
Page 1: Deploy a php app on Google App Engine

Deploy !a PHP Application!on Google App Engine

Page 2: Deploy a php app on Google App Engine

Who am I?

Michele Orselli!CTO@Ideato! !@[email protected]

Page 3: Deploy a php app on Google App Engine

Titolo Testo

PHP for App Engine

https://developers.google.com/events/io/sessions/333055646

Page 4: Deploy a php app on Google App Engine

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/

Page 5: Deploy a php app on Google App Engine

Google App Engine: services

All PaaS have limitations!

PHP is in preview phase!

Not all services are available

https://developers.google.com/appengine/features

Page 6: Deploy a php app on Google App Engine

Google App Engine: data storage

Google Cloud Sql !

Memcache!

Google Cloud Storage

Page 7: Deploy a php app on Google App Engine

Google App Engine: ext services

Email (internal or SendGrid)!

Twilio!

UrlFetch

Page 8: Deploy a php app on Google App Engine

Google App Engine: offline work

TaskQueue!

Cron

Page 9: Deploy a php app on Google App Engine

Google App Engine: auth

User Auth!

Application Identity

Page 10: Deploy a php app on Google App Engine

Titolo Testo

PHP on GAE

Page 11: Deploy a php app on Google App Engine

PHP 5.4!

Runs in a sandbox

https://developers.google.com/appengine/docs/php/

PHP on GAE

Page 12: Deploy a php app on Google App Engine

Some well-know extension are disabled: imagick, intl, pcntl, curl

PHP on GAE

Page 13: Deploy a php app on Google App Engine

Some well-know extension are disabled: imagick, intl, pcntl, curl

PHP on GAE

whaaat?

Page 14: Deploy a php app on Google App Engine

Some function are disabled!

permanently: exec, tmpfile!

partially: /e on preg_replace!

softly: gc_*, parse_str

PHP on GAE

Page 15: Deploy a php app on Google App Engine

File System is Read only: you can store files on Cloud Storage or external services

PHP on GAE

Page 16: Deploy a php app on Google App Engine

PHP on GAE

Page 17: Deploy a php app on Google App Engine

Cannot invoke external services directly (no curl remember? :-P)

PHP on GAE

Page 18: Deploy a php app on Google App Engine

PHP on GAE

Page 19: Deploy a php app on Google App Engine

Dynamic response max 32 MB!

Timeout on long response

PHP on GAE

Page 20: Deploy a php app on Google App Engine

Sessions are stored on Memcache !

session_*, $_SESSION work as expected!

use session_set_save_handler to change handler

PHP on GAE

Page 21: Deploy a php app on Google App Engine

Log are managed via syslog!

use syslog function!

use custom logging lib (eg. Monolog)

PHP on GAE

Page 22: Deploy a php app on Google App Engine

PHP on GAE

Page 23: Deploy a php app on Google App Engine

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

Page 24: Deploy a php app on Google App Engine

# app.yaml application: propane-forge-391 version: 1 runtime: php api_version: 1 threadsafe: true

Base Config

Page 25: Deploy a php app on Google App Engine

# app.yaml application: propane-forge-391 version: 2 runtime: php api_version: 1 threadsafe: true

Base Config

Page 26: Deploy a php app on Google App Engine

# app.yaml — continued handlers: - url: /css static_dir: web/css - url: /js static_dir: web/js - url: .* script: web/index.php

Base Config

Page 27: Deploy a php app on Google App Engine

# php.ini google_app_engine.enable_functions = “…”

Base Config

Page 28: Deploy a php app on Google App Engine

!dev_appserver.py --php_executable_path=/usr/bin/php-cgi /

var/www/todo/

Test Locally

Page 29: Deploy a php app on Google App Engine

Deploy

!appcgf.py update /var/www/todo/!

(or git push)

Page 30: Deploy a php app on Google App Engine

show me the code!

https://github.com/ideatosrl/silex-todo-gae

Page 31: Deploy a php app on Google App Engine

That’s all folks

Thank you!@_orso_ [email protected]


Top Related