2

I cannot do a simple write operation on my Google Cloud Bucket. I have followed the docs to the detail. This is what I have: A default bucket, A php script, all api needed enabled.

Here is my script

<?php
   file_put_contents('gs://myappid.appspot.com/hello.txt', 'Hello');
?>

Yet this does not write. What am I missing?

Stuart Langley
  • 7,044
  • 1
  • 20
  • 20
superuserdo
  • 1,637
  • 3
  • 21
  • 33
  • what do your app logs say? are you sure you are writing to the correct bucket? – Stuart Langley Dec 13 '14 at 05:26
  • @StuartLangley I am not using an app. I am logged in to my remote google cloud VM server and I am just using this php script to try to write to the bucket when I run it. – superuserdo Dec 13 '14 at 05:27
  • 2
    Just to be clear, you're using a GCE VM and not AppEngine? Your example is very app engine specific. file_put_contents('gs://...') is an App Engine thing and doesn't work with in a normal PHP environment. Doing this in normal PHP is more involved. Here is an example: https://cloud.google.com/storage/docs/json_api/v1/json-api-php-samples – Brandon Yarbrough Dec 13 '14 at 10:35
  • @BrandonYarbrough Yes GCE VM and not AppEngine and I will try this method you gave and let you know – superuserdo Dec 13 '14 at 22:04
  • Hi, I'm a representative of Google Cloud Platform. Were you able to solve this issue by following @Brandon suggestion? – Mario Dec 16 '14 at 12:08
  • @Mario I just tried it and no I was not able to. I am unsure what the problem is – superuserdo Dec 16 '14 at 15:36

1 Answers1

0

According to the latest docs you seem to also need to have billing enabled, even if you are only planning to use the free quota.

varepsilon
  • 488
  • 5
  • 8
  • @superuserdo Try enabling "Cloud Integration" at the bottom of the page in the "Application Settings" menu of the old AppEngine console (https://appengine.google.com/). I think that what made it working for me in the end. – varepsilon Jan 08 '15 at 19:46