Your SlideShare is downloading. ×
appengine ja night #25 Google App Engine for PHP (English)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

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

494
views

Published on

This is a slide about 'Google App Engine for PHP' written in English. …

This is a slide about 'Google App Engine for PHP' written in English.
I wrote it for the developer event named "appengine ja night" in Japan.

And I added some contents which I spoke in the event to this slide.
Therefore, the English version is written in more detail than Japanese version.

Unfortunately, I'm not good at English. (I'm studying English now)
But I think that it is more readable than Japanese for many people.

Please tell me if you find mistakes (in the point of English or Technology).


- Japanese Version
http://www.slideshare.net/vierjp/ja-night25

Published in: Technology, News & Politics

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
494
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 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

×