laravel在heroku上部署失败 [英] laravel deployment failed on heroku
问题描述
几个月前,我成功地在Heroku上部署了Laravel 5.5应用程序.
Some months ago I succeeded in deploying a Laravel 5.5 application on Heroku.
我今天尝试使用Laravel 6.12应用程序执行相同的操作,但是我遇到了很多问题.我添加了 .env
vars,我添加了 Procfile
.但是我有这个错误:
I tried to do the same today with a Laravel 6.12 application, and I have a lot of problems. I added the .env
vars, I added the Procfile
. But I have this error:
Laravel 5.5和6之间在部署到Heroku方面是否有所改变?我该如何工作?
Did something change between Laravel 5.5 and 6 for deploying to Heroku? How can I get this working?
我的 post-install-cmd
是:
"post-install-cmd": [
"php artisan cache:clear",
"php artisan config:cache",
"chmod -R 777 storage",
"php artisan passport:keys"
]
推荐答案
您正在使用默认的 file
会话驱动程序,但这不适用于Heroku.其文件系统是短暂的,并且对于每个dyno都是本地的.
You're using the default file
session driver, but this isn't a good fit on Heroku. Its filesystem is ephemeral and local to each dyno.
尝试通过设置 SESSION_DRIVER
使用其他会话驱动程序代码>环境变量:
Try using a different session driver by setting the SESSION_DRIVER
environment variable:
heroku config:set SESSION_DRIVER=cookie
cookie
可能是最简单的,但是如果您设置了其中一个,则 memcached
或 redis
也可以很好地工作.
cookie
is probably simplest, but memcached
or redis
would work well too if you have either of those set up.
Laravel 5.5和6之间的默认会话驱动程序没有变化,但我也不建议在Heroku上将 file
与Laravel 5.5一起使用.
The default session driver didn't change between Laravel 5.5 and 6, but I wouldn't recommend using file
with Laravel 5.5 on Heroku either.
这篇关于laravel在heroku上部署失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!