If you’re new to App Engine, then the file system model may be a bit different from what you might have experienced using other hosts.
With an App Engine application, you cannot write to the file-system where your application is deployed. Your application can read any files from the deployed directory structure, but it can’t write to that file-system. Instead, the application can use Google Cloud Storage (GCS) for both reading and writing files.
To convert an app to use GCS for writable files, here are the primary things that you will typically need to do:
Another implication of the read-only file system is that if your app has a ‘plugin’ model, like WordPress, you can’t install or update plugins from your deployed app. Instead, you will need to install or update any plugins locally, then redeploy the app.
You can find lots more info on all of the following in the documentation for the PHP runtime.
We’re happy to announce that we’ve just released version 1.2 of the App Engine WordPress plugin. The new version includes the following changes
- Fix for the bug “Uncaught exception ‘InvalidArgumentException’ with message ‘max_bytes_per_blob must be an integer'” (forum link)
- Removes the need for PIL to be installed in the local development environment.
- Removes the need for PyCrypto to be installed in the local development environment.
- Better checking if the application has write access to the Google Cloud Storage bucket for uploads.
If you find any issues with the latest version of the plugin you can file them in the support forum.
We also gladly accept pull requests – you can find the plugin source on Github.
Sitemaps are a valuable tool in helping search engines crawl your website. In this post I’ll show you how you can have a dynamically generated sitemap for a WordPress blog hosted on Google App Engine.
Because of the read-only nature of the file system on App Engine, we’ll use Google Cloud Storage to store the generated sitemap file. We’ll also add some handlers to serve the sitemap, and to update it as part of a scheduled cron job.
This is the second in a series of posts on using the Google Cloud Datastore on PHP App Engine.
The code for the examples in this post is here: https://github.com/amygdala/appengine_php_datastore_example.
The previous post walked through the process of setting up your PHP App Engine app to connect with the Datastore, using the Google API client libraries.
It demonstrated how to create a test Datastore entity, and showed how to set up a “Datastore service” instance, using a
DatastoreService class, to make it easier to send requests.
However, using the API client libraries, there is a fair bit of overhead in composing requests to the Datastore and processing the responses, and mapping entities to instances of classes in your app. So, in this post, we’ll define some classes to make it easier to create, update, and fetch Datastore entities.
We’ll define a `Model` base class, then show an example of subclassing it to map to a specific Datastore Kind.
In this post, we’ll show how to access the Google Cloud Datastore from a PHP App Engine app.
This is the first in a series of posts on using the Cloud Datastore on PHP App Engine.
The code for the examples in this post is here: https://github.com/amygdala/appengine_php_datastore_example. (Some of the files in this repo won’t be mentioned in this post, but will be referenced in the post that follows this one).
PHP on Google App Engine supports several alternatives as for a persistent store. One is the Cloud Datastore, a distributed, robust, fully managed, schemaless database, which supports transactions and scales automatically.
(If you have built App Engine apps for other runtimes, this is the same Datastore that you’ve used before; it now supports an HTTP interface as well).
This article assumes that you already have a basic familiarity with Datastore concepts.
There is not yet a native Datastore API for PHP on app engine. So, instead we’ll show how to use the Cloud Datastore API to connect to the Datastore from your PHP app.
First, we’ll show how to configure your app and associated Cloud Project so that your app will be able to connect to the Datastore.
Then, we’ll look at how to use the Google API client libraries as a basis for authenticating with the Datastore, sending requests, and receiving responses, and we’ll build a
DatastoreService class to make connecting a bit easier.
Mads Møller just posted some simple (well looks simple to me anyway) instructions on how to get a Joomla! based site up and running on App Engine.
You can find the instructions in the Joomla! forum here.
App Engine 1.8.8 has just been released, and the PHP runtime has some great updates:
- The Socket API is now available for billing-enabled Applications.
- PHP String has been added as a key type in the Admin Console Memcache viewer.
CloudStorageTools::getPublicUrl() method for constructing URLs for Google Cloud Storage objects.
- Opening GCS objects in text mode is now supported.
- A false error is now returned if
stream_cast is called on a GCS stream.
Many App Engine PHP apps use a Cloud SQL database. Here is a great new “getting started” video on Cloud SQL.
Getting Started with Google Cloud SQL
Jimmy Berry, on the App Engine PHP runtime team, has written a great walkthrough, accompanied by full example code that you can download, on running Drupal on App Engine using an integration module that he has developed.
This article walks through the process of deploying a Laravel 4 app to the App Engine PHP runtime.
Laravel is a web application framework that supports common tasks used in the majority of web projects, such as authentication, routing, sessions, and caching.
The Laravel 4 Starter Kit developed by Bruno Gaspar demos a simple blog application, and is a nice example of how to use the Laravel framework itself, as well as some of its packages. It should get you started on how to define and deploy your own app. If you’re not familiar with Laravel, you will find it useful to look over its documentation as well.
We’ll look at how to deploy this ‘starter kit’ app to App Engine.
Thanks and credit to Gilles Mergoil, who authored this blog post on running Laravel on a previous release of App Engine.