Google Cloud Platform
PHP

Setup

Your app requires a properly configured Google Cloud Storage bucket. Fortunately, each app can easily gain access to such a bucket if you do the following:

  1. Enable billing for your project, if you haven't already done so.
  2. Click Create bucket in the Storage Browser for your project.

Note you may incur costs by using a Cloud Storage bucket, unless the bucket is a default bucket.

About default Cloud Storage buckets

Applications created using the old App Engine console could use a default Cloud Storage bucket, which had free quota and didn't require billing to be enabled for the app. These applications continue to work as before in the Google Cloud Platform Console.

However, for new projects created in the Google Cloud Platform Console, there is no default bucket.

Useful tricks when using default buckets

When using a default bucket, you don't actually need to know your bucket name: you can use #default# and this will be replaced at runtime by the name of the default bucket.

For example, you would write to the default bucket using the normal Cloud Storage stream wrapper:

<?php
file_put_contents('gs://#default#/hello.txt', 'Hello');

or

<?php
$fp = fopen('gs://#default#/some_file.txt', 'w');
fwrite($fp, 'Hello');
fclose($fp);