Problems using Cloud Storge in my apllication

50 views
Skip to first unread message

Pablo Nieto

unread,
Jun 20, 2022, 11:12:07 AMJun 20
to Google App Engine
Hi all.

I'm deploying my Yii 2 PHP application in Google Cloud Platform, using App Engine. Locally, the app works fine, but it doesn't work at Google Cloud. I dont't know how to configure my application to work wit Goocle Cloud Storage. I have this code at config/web.php:

'components' => [
        'assetManager' => [
            'basePath'=>'gs://url-to-my-bucket',
            'baseUrl'=>'@web',
        ],

But I have the next exception:

excepcion.png

Locally, I use this code:

'components' => [
        'assetManager' => [
            'basePath'=>'@webroot',
            'baseUrl'=>'@web',
        ],

And it works, but in Google Cloud I have another exception:

excepcion2.png

¿What can I do? I don't have experience with Yii 2 and also wit Google Cloud :(

Thank you very much, sorry if my English is not very well.

Osvaldo Lopez Acuña

unread,
Jun 20, 2022, 2:18:25 PMJun 20
to Google App Engine
Are you able to connect locally to Google Cloud Storage? Are you using a standard or flexible App Engine environment? Which PHP version are you working on?

Pablo Nieto

unread,
Jun 21, 2022, 11:36:38 AMJun 21
to Google App Engine
HI.

PHP 8.1, I dont't know if standard or flexible. Yes, I can connect to Gcloud Storage with web browser.

Message has been deleted

Andres Fiesco Casasola

unread,
Jun 21, 2022, 6:03:54 PMJun 21
to Google App Engine

It is important to know if you are using a flexible or standard environment since flex environment is compatible with PHP 7.2 and 7.3 runtimes, and standard is compatible with PHP 8.1, but in its preview phase [1], [2].  You can use PHP 8.1 in flex environment, but you need to use custom runtimes [5] and provide a custom Docker image or Dockerfile from the open source community.

How to know if you are in a Standard or Flexible environment:

In your app.yaml, find the runtime line.

If it looks similar to the following: 

runtime: php81 # Replace with php74 to use PHP 7.4

Then you are running under a standard environment [3]. 

And if it looks like this other example: 

runtime: python

env: flex

runtime_config:

    python_version: 3

Then you are using a flexible environment for the deployment [4]. 


[1]:https://cloud.google.com/appengine/docs/php

[2]:https://cloud.google.com/appengine/docs/the-appengine-environments   

[3]:https://cloud.google.com/appengine/docs/standard/php-gen2/config/appref 

[4]:https://cloud.google.com/appengine/docs/flexible/python/reference/app-yaml#general  

[5]:https://cloud.google.com/appengine/docs/flexible/custom-runtimes/quickstart  

Pablo Nieto

unread,
Jun 23, 2022, 7:31:01 AMJun 23
to Google App Engine
I have only runtime: php81 in my app.yaml.
Reply all
Reply to author
Forward
0 new messages