Today we announced the 1.8.3 release of App Engine, which contains a bunch of spiffy new features and fixes for the PHP runtime. It’s worthwhile highlighting some of the new features and changes in this release.
Whitelisted users are now able to deploy PHP to any of their apps.
If your user account has previously been whitelisted for a PHP application, then you can now use PHP with any of your applications, including new ones. This includes applications located in the European Union.
Environment variables that are set in app.yaml are now available in the PHP runtime.
To configure environment variables, add them to your
app.yaml file using the
Your application will then be able to read these environment variables back at runtime.
>>> echo getenv('foo'); bar
Read-through cache for Google Cloud Storage
We’ve added a read-through cache for Google Cloud Storage files that are being accessed through our stream wrapper. By default, we cache files as you read them in memcache, and on subsequent reads we will retrieve the file from memcache and return the contents if they have not changed.
To determine if the contents of a file have changed or not, we make a request to Google Cloud Storage. So in the case of a file that has not changed, we don’t need to retrieve the contents, but we still need to incur the penalty of at least 1 round trip to Google Cloud Storage.
If you have an application where you know the files are not going to change once they’re written, or you’re prepared to occasionally be served stale file contents, then you can skip the contents change check by enabling optimistic caching of the file. With optimistic caching on, if we find the file in memcache, we will return the contents without checking that the file is still current, so no additional roundtrip call to Google Cloud Storage is performed.
You can configure read caching using the stream context options that you pass when opening the file.
$gs_options = [ 'gs' => [ "enable_cache" => true, // true by default, false disables all read caching "enable_optimistic_cache" => true, // false by default, true enables optimistic caching "read_cache_expiry_seconds" => 3600, // Number of seconds that reads are cached in memcache. ]]; stream_context_set_default($gs_options);
We will invalidate the read cache if you write to the file from your application, so that it is cached again on the next read. Note that we don’t invalidate the cache if the file is changed from outside of your application by directly uploading to the bucket, or on a rename.