Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Sinnbeck's avatar
Level 102

Laravel on gcloud standard

Has anyone tried running laravel on gcloud (google cloud)? I found this guide, but it seems to be lacking alot (assets not working) and errors (using env() inside bootstrap/app.php).

https://cloud.google.com/community/tutorials/run-laravel-on-appengine-standard

Also laravel breaks at each deploy unless I use the beta sdk to deploy without cache

ReflectionException Class translator does not exist
0 likes
4 replies
Coola's avatar

I have recently used it with Laravel 7. Are you getting a specific error? Maybe I can help (although I must say I am new to it too).

Sinnbeck's avatar
Level 102

@bobbybouwmann Thanks, but I was hoping to use the app engine (standard) serverless. I am also looking into either google functions and google run. It is just a hobby project, and I am basicly testing if it is possible to deploy something like vapor does to google instead of AWS

@coola When deploying, are you also getting that exception I was talking about? It worked on first deploy and the next ones need to be run with beta sdk

gcloud beta app deploy --no-cache

And how does your app.yml look? This is mine after some tinkering around

runtime: php72

env_variables:
  ## Put production environment variables here.
  APP_KEY: base64:f+iGyneY5p77j0r78SJbutV8HAYpsZICvpBVWWDLVrY=
  SESSION_DRIVER: cookie

handlers:
  - url: /js
    static_dir: public/js

  - url: /css
    static_dir: public/css

  # Serve images as static resources.
  - url: /(.+\.(gif|png|jpg))$
    static_files: 
    upload: .+\.(gif|png|jpg)$

I was also hoping to find a way to run artisan commands. Like migrate from php instead of having to set up a proxy tunnel to the sql server. Or run other artisan commands and get their output

1 like
Coola's avatar

Sorry for the late response. Were you able to solve it? What was your post-install-cmd in your composer.json as that for me gave me tons of errors. I finally settled for something like:

"post-install-cmd": [
"Illuminate\Foundation\ComposerScripts::postInstall",
"@php artisan optimize:clear", //clears all cache
"@php artisan optimize", //optimizes all caches
"composer dump-autoload",
"chmod -R 755 bootstrap\/cache",
"@php artisan cache:clear" // clears the cache
]

I had several caching issues when redeploying, so it turned out that I need to clear the caches upon deployment to app engine.

Please or to participate in this conversation.