SlideShare a Scribd company logo
1 of 33
Download to read offline
Google App Engine for PHP	
appengine ja night #25
Ryo Yamasaki @vierjp
1
•  Blog
•  http://blog.vier.jp/
•  Twitter
•  @vierjp
•  Work
•  I mainly develop server side applications by Java.
(Sorry, I’m newbie of PHP.)
•  I was a technical leader for the smart phone service provider
company in the previous job.
•  I had used the products of Google Cloud Platform, such as App
Engine, Cloud Storage and BigQuery.
•  Publishing Android apps
•  WiFi Tunes Sync
•  WiFi Tunes Sync Pro
Ryo Yamasaki	
Self Introduction	
2
Google App Engine for PHP	
3	
Agenda	
1.  Overview of GAE/PHP
2.  Updating after Google I/O
3.  IDE for GAE/PHP
4.  Deploying existing applications
5.  Notes of deploying existing applications
6.  How to use CakePHP on GAE/PHP
Google App Engine for PHP	
4	
Overview
Google App Engine for PHP	
•  PHP was added
•  It was announced on May 15th 2013 at
Google I/O
•  Now Limited Preview (You can apply for it)
•  PHP Version 5.4.8
•  You can use Cloud SQL
•  You (maybe) can use Cloud Datastore API
Overview
5
Google App Engine for PHP	
•  App Engine Ver.1.8.1
•  mbstring (Multibyte String Functions) added.
•  mcrypt (Encryption Functions) added.
•  iconv (Character encodings conversion) added.
•  Including script files from Google Cloud
Storage
Updating after Google I/O (1)	
6
Google App Engine for PHP	
•  How to include PHP scripts from Cloud Storage
Updating after Google I/O (2)	
7	
<?php
require_once "gs://my_bucket/file.php";	
google_app_engine.allow_include_gs_buckets = "my_bucket"	
•  php.ini
Google App Engine for PHP	
8	
IDE for GAE/PHP
Google App Engine for PHP	
•  The popular PHP IDE for PHP developers
•  Supporting GAE / PHP
•  You can debug and deploy with the IDE.
•  You can use this for free for a month.
PhpStorm	
9
Google App Engine for PHP	
PhpStorm : Debug	
10
Google App Engine for PHP	
PhpStorm : Deploy	
11
Google App Engine for PHP	
12	
Deploying existing
applications
Google App Engine	
phpinfo	
13	
•  View information
environment of PHP
•  Server Configuration
•  PHP extensions
http://phpinfo.vier-test.appspot.com/
Google App Engine	
Word Press Ver.3.5.1 (Japanese Version)	
14	
http://vier-test.appspot.com/
•  No problem on posting and
displaying in Japanese.
•  The WordPress plugin for GAE/
PHP has been provided.
Google App Engine for PHP	
•  You can upload Files.
•  You can receive emails when someone comments
on your posts.
•  UI for some there was a problem is corrected.
WordPress plugin for GAE/PHP (provided by Google)	
15
Google App Engine for PHP	
1.  WP Multibyte Patch
This is included in Japanese Version.
And this plugin depends on mbstring.
2.  Memcached Object Cache
3.  Batcache
4.  Wptouch
5.  FancyBox
6.  WP Social Bookmarking Light
7.  Secure WordPress
8.  Crazy Bone
I tried some WordPress Plugins	
16
Google App Engine	
phpMyAdmin Ver.4.0.3	
17	
•  Management tools for MySQL
Google App Engine for PHP	
•  WordPress
•  List of Articles
•  Article detail
•  Posting an article and an image
•  Plugin
•  Access from smartphones
Demo : WordPress	
18
Google App Engine for PHP	
19	
Notes of deploying existing
applications
Google App Engine	
•  Limitation of GAE / PHP
•  Applications can't write to the local file system.
•  They need to use Cloud Storage instead of the local
file system.
•  On GAE/PHP, you can't upload files in a
standard way of PHP.
•  Can not be used to '$_FILES' in a general way.
•  You must upload directly to Cloud Storage.
•  Can not be used functions that operate the System or
Process.
•  Developers can’t add PHP extensions.
Notes of deploying existing applications	
20
Google App Engine for PHP	
1.  The I/O to the file system
•  You need to change the path of the file to write to Cloud Storage path.
•  However, there is some cases to cause problems by simply changing the path.
•  (It mentions later in detail.)
2.  File uploading function
•  You need to change upload process to the unique way of GAE / PHP.
•  See: https://developers.google.com/appengine/docs/php/googlestorage/
3.  Logging function
•  Using ‘syslog’ function.
•  Thereby, you can see the logs on the Admin Console of App Engine.
4.  Session Management
•  The session data is written to only Memcache by default.
•  Therefore, the session data might disappear suddenly.
•  This problem can be solved by implementing your own session handler using other data
storage,such as Google Cloud SQL.
•  See: https://developers.google.com/appengine/docs/php/#Sessions
5.  Sending email function
(It mentions later in detail.)
6.  Required PHP extensions
•  Developers can’t add PHP extensions.
Notes of deploying existing applications	
21
Google App Engine for PHP	
•  Basically, it is possible to read and write files with the
standard PHP function if you change the path to the pass
of Cloud Storage.
•  Accessing to files and directories on Cloud Storage is
processed using “Stream Wrapper (function of PHP) ”.
•  Behavior of operations on the directory is doubtful.(Issue:9368)
•  Checking existence of directory
•  Creating Directory
•  etc.
•  Problems may occur if the existing code use specific
functions.
•  ‘realpath’ function (Stream Wrapper is not support this function.)
The supplementary note about File I/O	
22
Google App Engine for PHP	
•  The 'mail' function of PHP doesn't seem to work.
•  An error occurred. “The function mail is not implemented. “
•  It is not documented.	
•  The plugin for WordPress sends emails in the following way.
The supplementary note about sending email	
23	
require_once 'google/appengine/api/mail/Message.php';
use googleappengineapimailMessage;
// Use the class for App Engine’s MailService.
$mail = new Message();
// Now MailService doesn’t support view name of ‘From Address’.
// ( It is written in comment of the WordPress Plugin.)
//$mail->setSender(' Ryo Yamasaki <eins@vier.jp>');
$mail->setSender( 'eins@vier.jp’ );
$mail->addTo( ’test@vier.jp’ );
$mail->setSubject( 'Test Subject' );
$mail->setTextBody( 'Test Message' );
// Send !	
$mail->send();	
This code has been simplified.
Google App Engine for PHP	
24	
How to use CakePHP
on GAE/PHP
Google App Engine for PHP	
•  Googler wrote about conditions of
frameworks for GAE/PHP on Issue
Tracker.(Issue:9336)
1.  Not writing temporary files to the file system
of GAE.
2.  Logging uses ‘syslog()’ function.
How to use CakePHP on GAE/PHP	
25
Google App Engine for PHP	
•  The default CakePHP write various files to the tmp directory of the app.
How to use CakePHP on GAE/PHP	
26	
•  It caused an error.
•  And an error was occurred at
the checking existence of
directory, even if I specified
the path of Cloud Storage as
the tmp directory.(Issue:9368)
Google App Engine for PHP	
•  CakePHP has mechanisms for switching the target of
the I/O.
1.  I specified APC or Memcache as destination of temporary data.
2.  I specified syslog function as how to output log.
(The code --SyslogLog.php-- is included in CakePHP 2.4.)
3.  I changed the storage location of session data into CloudSQL.
(This is not required. But I recommend.)
How to use CakePHP on GAE/PHP	
27	
* There are detailed codes on my blog and GitHub.
http://blog.vier.jp/2013/07/39google-app-engine-for-phpcakephp.html
https://github.com/vierjp/CakePHPTest3
This blog is written in Japanese.
But, if you know CakePHP, you might be able to understand the code.
Also, please try to the "Translate" where is right side of the blog page.
If you have any questions, please contact me.(on Google+ or twitter)
Google App Engine for PHP	
•  You can not send emails with the standard code of
CakeEmail.
•  The ‘mail’ function doesn’t work.
•  It isn't possible to socket communication with the SMTP server.
•  It is possible to send by creating a class (the class called
'Transport') that uses the MailService, and switching to it.
•  It is possible to attach to email static files that is included in the
app.
•  But modifying codes of CakeEmail is needed to attach the files
which put on Cloud Storage. (because CakeEmail uses 'realpath'
function.)	
  
Cake/Email	
28
Google App Engine for PHP	
1.  Simple CRUD processing. (list, registration, edit, and delete)
2.  Authentication using UserService of App Engine.
3.  Only administrative users and posters can edit or delete.
Demo : a sample application of CakePHP	
29	
http://cake2.vier-test.appspot.com/
Google App Engine for PHP	
•  Portability
•  Existing applications work to some extent.
•  Existing frameworks work if they match some
conditions.
•  If some functions become to work transparently, then
GAE/PHP becomes even better.
•  Uploading files
•  Operation of files and directories against Cloud Storage
•  Sending emails
•  Scalability
•  I think that if GAE/PHP becomes to be able to use
Datastore as well as other languages, then it
becomes even better.
Summary	
30
Google App Engine	
•  Google App Engine for PHP Limited Preview (Here, you can apply for GAE/PHP)
•  https://gaeforphp.appspot.com/
•  Google App Engine for PHP (Official Documents)
•  https://developers.google.com/appengine/docs/php/
•  Tips and tricks from the Google App Engine PHP team
•  https://gaeforphp-blog.appspot.com/
•  PHP IDE :: JetBrains PhpStorm
•  http://www.jetbrains.com/phpstorm/
•  Getting Started with PhpStorm as Google App Engine PHP IDE
•  http://goo.gl/1pOS6
•  WordPress › 日本語 (Japanese Version)
•  http://ja.wordpress.org/
•  WordPress › Google App Engine for WordPress « WordPress Plugins
•  http://wordpress.org/plugins/google-app-engine/
•  Google Cloud Datastore (Official Documents)
•  https://developers.google.com/datastore/docs/overview
31	
Related URLs.
Google App Engine	
•  27.Google I/Oで発表されたCloud Platformの新機能
•  http://blog.vier.jp/2013/05/google-iogoogle-cloud-platform.html
•  28.Google App Engine for PHP (GAE/PHP) を早速試してみた
•  http://blog.vier.jp/2013/05/google-app-engine-for-php-gaephp.html
•  29.Google App Engine for PHPで WordPress を動かしてみた
•  http://blog.vier.jp/2013/05/29google-app-engine-for-phpwordpress.html
•  30.Google App Engine for PHPにおけるポータビリティを考える
•  http://blog.vier.jp/2013/05/30google-app-engine-for-php.html
•  36.Google App Engine for PHPで WordPress を運用するためのプラグイン	
•  http://blog.vier.jp/2013/06/37google-app-engine-for-phpwordpress.html
•  39.Google App Engine for PHP で CakePHP を動かしてみた
•  http://blog.vier.jp/2013/07/39google-app-engine-for-phpcakephp.html
•  33.Google Cloud Datastoreを試してみた 概要編 (1/3)
•  http://blog.vier.jp/2013/06/33google-cloud-datastore-13.html
32	
Related My Blog URLs.
Thanks for your reading!
	
@vierjp
http://blog.vier.jp/	
Google App Engine for PHP

More Related Content

What's hot

Implementing xpages extension library
Implementing xpages extension libraryImplementing xpages extension library
Implementing xpages extension library
dominion
 

What's hot (20)

Tutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer WorkshopTutorial 1: Your First Science App - Araport Developer Workshop
Tutorial 1: Your First Science App - Araport Developer Workshop
 
All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$
 
Implementing xpages extension library
Implementing xpages extension libraryImplementing xpages extension library
Implementing xpages extension library
 
Master Chef class: learn how to quickly cook delightful CQ/AEM infrastructures
Master Chef class: learn how to quickly cook delightful CQ/AEM infrastructuresMaster Chef class: learn how to quickly cook delightful CQ/AEM infrastructures
Master Chef class: learn how to quickly cook delightful CQ/AEM infrastructures
 
Maven tutorial
Maven tutorialMaven tutorial
Maven tutorial
 
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
Chef Fundamentals Training Series Module 6: Roles, Environments, Community Co...
 
DanNotes XPages Mobile Controls
DanNotes XPages Mobile ControlsDanNotes XPages Mobile Controls
DanNotes XPages Mobile Controls
 
AtoM's Command Line Tasks - An Introduction
AtoM's Command Line Tasks - An IntroductionAtoM's Command Line Tasks - An Introduction
AtoM's Command Line Tasks - An Introduction
 
Maven tutorial for beginners
Maven tutorial for beginnersMaven tutorial for beginners
Maven tutorial for beginners
 
Cakephp manual-11
Cakephp manual-11Cakephp manual-11
Cakephp manual-11
 
BP204 It's Not Infernal: Dante's Nine Circles of XPages Heaven
BP204 It's Not Infernal: Dante's Nine Circles of XPages HeavenBP204 It's Not Infernal: Dante's Nine Circles of XPages Heaven
BP204 It's Not Infernal: Dante's Nine Circles of XPages Heaven
 
Top 50 Interview Questions and Answers in CakePHP
Top 50 Interview Questions and Answers in CakePHPTop 50 Interview Questions and Answers in CakePHP
Top 50 Interview Questions and Answers in CakePHP
 
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
Community Cookbooks & further resources - Fundamentals Webinar Series Part 6
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 
Laravel 5.4
Laravel 5.4 Laravel 5.4
Laravel 5.4
 
Compliance Automation Workshop
Compliance Automation WorkshopCompliance Automation Workshop
Compliance Automation Workshop
 
Automating your infrastructure with Chef
Automating your infrastructure with ChefAutomating your infrastructure with Chef
Automating your infrastructure with Chef
 
PHP Conference - Phalcon hands-on
PHP Conference - Phalcon hands-onPHP Conference - Phalcon hands-on
PHP Conference - Phalcon hands-on
 
Introduction to chef
Introduction to chefIntroduction to chef
Introduction to chef
 
Take Your XPages Development to the Next Level
Take Your XPages Development to the Next LevelTake Your XPages Development to the Next Level
Take Your XPages Development to the Next Level
 

Viewers also liked (7)

Cloud computing and security 01
Cloud computing and security 01Cloud computing and security 01
Cloud computing and security 01
 
Google App Engine Developer - Day4
Google App Engine Developer - Day4Google App Engine Developer - Day4
Google App Engine Developer - Day4
 
Deploying to AppEngine
Deploying to AppEngineDeploying to AppEngine
Deploying to AppEngine
 
The 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for JavaThe 90-Day Startup with Google AppEngine for Java
The 90-Day Startup with Google AppEngine for Java
 
Understanding PaaS
Understanding PaaSUnderstanding PaaS
Understanding PaaS
 
Google I/O 2016 Recap - Google Cloud Platform News Update
Google I/O 2016 Recap - Google Cloud Platform News UpdateGoogle I/O 2016 Recap - Google Cloud Platform News Update
Google I/O 2016 Recap - Google Cloud Platform News Update
 
Google Cloud Platform 入門
Google Cloud Platform 入門Google Cloud Platform 入門
Google Cloud Platform 入門
 

Similar to appengine ja night #25 Google App Engine for PHP (English)

App_Engine_PPT..........................
App_Engine_PPT..........................App_Engine_PPT..........................
App_Engine_PPT..........................
HassamShahid2
 
Google appenginejava.ppt
Google appenginejava.pptGoogle appenginejava.ppt
Google appenginejava.ppt
Young Alista
 

Similar to appengine ja night #25 Google App Engine for PHP (English) (20)

Infinite Scale - Introduction to Google App Engine
Infinite Scale - Introduction to Google App EngineInfinite Scale - Introduction to Google App Engine
Infinite Scale - Introduction to Google App Engine
 
Google App Engine for PHP
Google App Engine for PHP Google App Engine for PHP
Google App Engine for PHP
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
 
App_Engine_PPT..........................
App_Engine_PPT..........................App_Engine_PPT..........................
App_Engine_PPT..........................
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
 
Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011Google app-engine-cloudcamplagos2011
Google app-engine-cloudcamplagos2011
 
Deploy a PHP App on Google App Engine
Deploy a PHP App on Google App EngineDeploy a PHP App on Google App Engine
Deploy a PHP App on Google App Engine
 
Google appenginejava.ppt
Google appenginejava.pptGoogle appenginejava.ppt
Google appenginejava.ppt
 
Google App Engine for Python - Unit01: Basic
Google App Engine for Python - Unit01: BasicGoogle App Engine for Python - Unit01: Basic
Google App Engine for Python - Unit01: Basic
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
SynapseIndia drupal presentation on drupal info
SynapseIndia drupal  presentation on drupal infoSynapseIndia drupal  presentation on drupal info
SynapseIndia drupal presentation on drupal info
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
Rapid Application Development on Google App Engine for Java
Rapid Application Development on Google App Engine for JavaRapid Application Development on Google App Engine for Java
Rapid Application Development on Google App Engine for Java
 
Intro to CakePHP 1.3
Intro to CakePHP 1.3Intro to CakePHP 1.3
Intro to CakePHP 1.3
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
Wc13
Wc13Wc13
Wc13
 
Google App Engine for Java
Google App Engine for JavaGoogle App Engine for Java
Google App Engine for Java
 
Cypress report
Cypress reportCypress report
Cypress report
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

appengine ja night #25 Google App Engine for PHP (English)

  • 1. Google App Engine for PHP appengine ja night #25 Ryo Yamasaki @vierjp 1
  • 2. •  Blog •  http://blog.vier.jp/ •  Twitter •  @vierjp •  Work •  I mainly develop server side applications by Java. (Sorry, I’m newbie of PHP.) •  I was a technical leader for the smart phone service provider company in the previous job. •  I had used the products of Google Cloud Platform, such as App Engine, Cloud Storage and BigQuery. •  Publishing Android apps •  WiFi Tunes Sync •  WiFi Tunes Sync Pro Ryo Yamasaki Self Introduction 2
  • 3. Google App Engine for PHP 3 Agenda 1.  Overview of GAE/PHP 2.  Updating after Google I/O 3.  IDE for GAE/PHP 4.  Deploying existing applications 5.  Notes of deploying existing applications 6.  How to use CakePHP on GAE/PHP
  • 4. Google App Engine for PHP 4 Overview
  • 5. Google App Engine for PHP •  PHP was added •  It was announced on May 15th 2013 at Google I/O •  Now Limited Preview (You can apply for it) •  PHP Version 5.4.8 •  You can use Cloud SQL •  You (maybe) can use Cloud Datastore API Overview 5
  • 6. Google App Engine for PHP •  App Engine Ver.1.8.1 •  mbstring (Multibyte String Functions) added. •  mcrypt (Encryption Functions) added. •  iconv (Character encodings conversion) added. •  Including script files from Google Cloud Storage Updating after Google I/O (1) 6
  • 7. Google App Engine for PHP •  How to include PHP scripts from Cloud Storage Updating after Google I/O (2) 7 <?php require_once "gs://my_bucket/file.php"; google_app_engine.allow_include_gs_buckets = "my_bucket" •  php.ini
  • 8. Google App Engine for PHP 8 IDE for GAE/PHP
  • 9. Google App Engine for PHP •  The popular PHP IDE for PHP developers •  Supporting GAE / PHP •  You can debug and deploy with the IDE. •  You can use this for free for a month. PhpStorm 9
  • 10. Google App Engine for PHP PhpStorm : Debug 10
  • 11. Google App Engine for PHP PhpStorm : Deploy 11
  • 12. Google App Engine for PHP 12 Deploying existing applications
  • 13. Google App Engine phpinfo 13 •  View information environment of PHP •  Server Configuration •  PHP extensions http://phpinfo.vier-test.appspot.com/
  • 14. Google App Engine Word Press Ver.3.5.1 (Japanese Version) 14 http://vier-test.appspot.com/ •  No problem on posting and displaying in Japanese. •  The WordPress plugin for GAE/ PHP has been provided.
  • 15. Google App Engine for PHP •  You can upload Files. •  You can receive emails when someone comments on your posts. •  UI for some there was a problem is corrected. WordPress plugin for GAE/PHP (provided by Google) 15
  • 16. Google App Engine for PHP 1.  WP Multibyte Patch This is included in Japanese Version. And this plugin depends on mbstring. 2.  Memcached Object Cache 3.  Batcache 4.  Wptouch 5.  FancyBox 6.  WP Social Bookmarking Light 7.  Secure WordPress 8.  Crazy Bone I tried some WordPress Plugins 16
  • 17. Google App Engine phpMyAdmin Ver.4.0.3 17 •  Management tools for MySQL
  • 18. Google App Engine for PHP •  WordPress •  List of Articles •  Article detail •  Posting an article and an image •  Plugin •  Access from smartphones Demo : WordPress 18
  • 19. Google App Engine for PHP 19 Notes of deploying existing applications
  • 20. Google App Engine •  Limitation of GAE / PHP •  Applications can't write to the local file system. •  They need to use Cloud Storage instead of the local file system. •  On GAE/PHP, you can't upload files in a standard way of PHP. •  Can not be used to '$_FILES' in a general way. •  You must upload directly to Cloud Storage. •  Can not be used functions that operate the System or Process. •  Developers can’t add PHP extensions. Notes of deploying existing applications 20
  • 21. Google App Engine for PHP 1.  The I/O to the file system •  You need to change the path of the file to write to Cloud Storage path. •  However, there is some cases to cause problems by simply changing the path. •  (It mentions later in detail.) 2.  File uploading function •  You need to change upload process to the unique way of GAE / PHP. •  See: https://developers.google.com/appengine/docs/php/googlestorage/ 3.  Logging function •  Using ‘syslog’ function. •  Thereby, you can see the logs on the Admin Console of App Engine. 4.  Session Management •  The session data is written to only Memcache by default. •  Therefore, the session data might disappear suddenly. •  This problem can be solved by implementing your own session handler using other data storage,such as Google Cloud SQL. •  See: https://developers.google.com/appengine/docs/php/#Sessions 5.  Sending email function (It mentions later in detail.) 6.  Required PHP extensions •  Developers can’t add PHP extensions. Notes of deploying existing applications 21
  • 22. Google App Engine for PHP •  Basically, it is possible to read and write files with the standard PHP function if you change the path to the pass of Cloud Storage. •  Accessing to files and directories on Cloud Storage is processed using “Stream Wrapper (function of PHP) ”. •  Behavior of operations on the directory is doubtful.(Issue:9368) •  Checking existence of directory •  Creating Directory •  etc. •  Problems may occur if the existing code use specific functions. •  ‘realpath’ function (Stream Wrapper is not support this function.) The supplementary note about File I/O 22
  • 23. Google App Engine for PHP •  The 'mail' function of PHP doesn't seem to work. •  An error occurred. “The function mail is not implemented. “ •  It is not documented. •  The plugin for WordPress sends emails in the following way. The supplementary note about sending email 23 require_once 'google/appengine/api/mail/Message.php'; use googleappengineapimailMessage; // Use the class for App Engine’s MailService. $mail = new Message(); // Now MailService doesn’t support view name of ‘From Address’. // ( It is written in comment of the WordPress Plugin.) //$mail->setSender(' Ryo Yamasaki <eins@vier.jp>'); $mail->setSender( 'eins@vier.jp’ ); $mail->addTo( ’test@vier.jp’ ); $mail->setSubject( 'Test Subject' ); $mail->setTextBody( 'Test Message' ); // Send ! $mail->send(); This code has been simplified.
  • 24. Google App Engine for PHP 24 How to use CakePHP on GAE/PHP
  • 25. Google App Engine for PHP •  Googler wrote about conditions of frameworks for GAE/PHP on Issue Tracker.(Issue:9336) 1.  Not writing temporary files to the file system of GAE. 2.  Logging uses ‘syslog()’ function. How to use CakePHP on GAE/PHP 25
  • 26. Google App Engine for PHP •  The default CakePHP write various files to the tmp directory of the app. How to use CakePHP on GAE/PHP 26 •  It caused an error. •  And an error was occurred at the checking existence of directory, even if I specified the path of Cloud Storage as the tmp directory.(Issue:9368)
  • 27. Google App Engine for PHP •  CakePHP has mechanisms for switching the target of the I/O. 1.  I specified APC or Memcache as destination of temporary data. 2.  I specified syslog function as how to output log. (The code --SyslogLog.php-- is included in CakePHP 2.4.) 3.  I changed the storage location of session data into CloudSQL. (This is not required. But I recommend.) How to use CakePHP on GAE/PHP 27 * There are detailed codes on my blog and GitHub. http://blog.vier.jp/2013/07/39google-app-engine-for-phpcakephp.html https://github.com/vierjp/CakePHPTest3 This blog is written in Japanese. But, if you know CakePHP, you might be able to understand the code. Also, please try to the "Translate" where is right side of the blog page. If you have any questions, please contact me.(on Google+ or twitter)
  • 28. Google App Engine for PHP •  You can not send emails with the standard code of CakeEmail. •  The ‘mail’ function doesn’t work. •  It isn't possible to socket communication with the SMTP server. •  It is possible to send by creating a class (the class called 'Transport') that uses the MailService, and switching to it. •  It is possible to attach to email static files that is included in the app. •  But modifying codes of CakeEmail is needed to attach the files which put on Cloud Storage. (because CakeEmail uses 'realpath' function.)   Cake/Email 28
  • 29. Google App Engine for PHP 1.  Simple CRUD processing. (list, registration, edit, and delete) 2.  Authentication using UserService of App Engine. 3.  Only administrative users and posters can edit or delete. Demo : a sample application of CakePHP 29 http://cake2.vier-test.appspot.com/
  • 30. Google App Engine for PHP •  Portability •  Existing applications work to some extent. •  Existing frameworks work if they match some conditions. •  If some functions become to work transparently, then GAE/PHP becomes even better. •  Uploading files •  Operation of files and directories against Cloud Storage •  Sending emails •  Scalability •  I think that if GAE/PHP becomes to be able to use Datastore as well as other languages, then it becomes even better. Summary 30
  • 31. Google App Engine •  Google App Engine for PHP Limited Preview (Here, you can apply for GAE/PHP) •  https://gaeforphp.appspot.com/ •  Google App Engine for PHP (Official Documents) •  https://developers.google.com/appengine/docs/php/ •  Tips and tricks from the Google App Engine PHP team •  https://gaeforphp-blog.appspot.com/ •  PHP IDE :: JetBrains PhpStorm •  http://www.jetbrains.com/phpstorm/ •  Getting Started with PhpStorm as Google App Engine PHP IDE •  http://goo.gl/1pOS6 •  WordPress › 日本語 (Japanese Version) •  http://ja.wordpress.org/ •  WordPress › Google App Engine for WordPress « WordPress Plugins •  http://wordpress.org/plugins/google-app-engine/ •  Google Cloud Datastore (Official Documents) •  https://developers.google.com/datastore/docs/overview 31 Related URLs.
  • 32. Google App Engine •  27.Google I/Oで発表されたCloud Platformの新機能 •  http://blog.vier.jp/2013/05/google-iogoogle-cloud-platform.html •  28.Google App Engine for PHP (GAE/PHP) を早速試してみた •  http://blog.vier.jp/2013/05/google-app-engine-for-php-gaephp.html •  29.Google App Engine for PHPで WordPress を動かしてみた •  http://blog.vier.jp/2013/05/29google-app-engine-for-phpwordpress.html •  30.Google App Engine for PHPにおけるポータビリティを考える •  http://blog.vier.jp/2013/05/30google-app-engine-for-php.html •  36.Google App Engine for PHPで WordPress を運用するためのプラグイン •  http://blog.vier.jp/2013/06/37google-app-engine-for-phpwordpress.html •  39.Google App Engine for PHP で CakePHP を動かしてみた •  http://blog.vier.jp/2013/07/39google-app-engine-for-phpcakephp.html •  33.Google Cloud Datastoreを試してみた 概要編 (1/3) •  http://blog.vier.jp/2013/06/33google-cloud-datastore-13.html 32 Related My Blog URLs.
  • 33. Thanks for your reading! @vierjp http://blog.vier.jp/ Google App Engine for PHP