Q:

AppEngine PHP storage not working in production

$file = 'gs://myapp.appspot.com/storage.json';

file_put_contents($file, $array);
$response = file_get_contents($file);

This works fine when I run appengine locally, but doesn't work in production.  Any suggestions welcome. 

A:

Probably the bucket name is wrong.  Try something like this which looks up the bucket name at runtime. 
use google\appengine\api\cloud_storage\CloudStorageTools;

$bucket = CloudStorageTools::getDefaultGoogleStorageBucketName();
$file = "gs://$bucket/storage.json";
file_put_contents($file, $array);
$response = file_get_contents($file);

