Category Archives: Uncategorized

What’s new for PHP runtime in the App Engine 1.8.4 release

Today we announced the 1.8.4 release of App Engine and although we’ve been busy working behind the scenes on a bunch of under the covers improvements, we’ve still managed to roll out a few nice new features and fixes for the PHP runtime. Once again, it’s worthwhile highlighting a few of these items.

The PHP interpreter was upgraded from PHP 5.4.8 to PHP 5.4.17

This picks up a lot of bug fixes from the PHP core team. For a detailed list please check the PHP5 Change Log.

The is_writable() method now supports Google Cloud Storage files and buckets.

This new feature brings us close to having Google Cloud Storage working similar to what is expected of a local file system for PHP applications. Supporting is_writable is an interesting use case – to be absolutely sure that the application has permission to write to a bucket, we have to start the process of writing an actual file to the bucket, and then check the result. As this is a comparatively time-consuming process, we cache the result in memcache the first time you call is_writable on a bucket. For example:

$my_bucket = 'gs://my_bucket/';
// Will make a request to GCS and cache the result.
$check1 = is_writable($my_bucket);
// Will retrieve the value of the previous call from the cache.  
$check2 = is_writable($my_bucket); 

Naturally this means that if you change the ACL on your Google Cloud Storage bucket, you app could read the incorrect value of is_writable from the cache. ACLs on Google Cloud Storage buckets are usually changed infrequently, so the likelihood of your app using a stale cached result is low. However, you can always flush memcache from your app’s admin console to clear the cached result.

By default the value is cached for 10 minutes, however you can change this by setting the 'writable_cache_expiry_seconds' value in the stream context configuration for Google Cloud Storage.

// Set a long writable cache timeout, as we never change the ACL on the bucket.
stream_context_set_default(['gs' => ['writable_cache_expiry_seconds' => '86400']]);

You no longer need to specify the PHP runtime when deploying applications

You longer need to specify -R when using to deploy php apps.

# Before
$ -R -A myapp update path/to/my/app/

# Now
$ -A myapp update path/to/my/app/

PHP, meet App Engine. App Engine, meet PHP.

Yesterday at Google I/O we announced the launch of the PHP runtime for App Engine.

In fact, we’re making this post from our I/O Session where we’re talking all about PHP on App Engine.

Now sadly while not everybody can be here with us in San Francisco, the great news is that the session is being live streamed right here, so come and learn all about how we’ve enabled hosting the worlds most popular web language on the worlds best cloud infrastructure.

For more information you can also visit GAE for PHP and sign up for access to the runtime, download the SDK and find links to the documentation.