1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UbuntuのLaravelが.envを読み込まない

1
Posted at

ようやくLaravelとの戦いもほぼ終焉。デプロイするだけなのに。。。

.env読まない問題。

.envにどれだけ書いていても、app.nameはLaravelに。
app.nameだけならいいけど、いろんなところに定数使ってるのでちょい困る。

もちろん、config.phpでも代用できるけど、できれば.envで管理したい。

権限の問題?

755とか、777とかまで試してみたけど、変わらない。

キャッシュのせいの人も多いっぽい

php artisan config:clear
php artisan config:cache

どちらか使おう。したは、さらにcacheも作っておいてくれる。

僕はだめだった。

envファイルの書き方が悪い?

envファイルの書き方(とくに空白の使い方)が悪いと、影響が出るらしい。

SITE_NAME=My website
ではなく
SITE_NAME="My website"

と書こう。ただ、これは既に知っていた上で上手く行ってない。

php artisan serveで対処法があるらしい

php artisan serve --port=8000 --host=0.0.0.0 &

これでいけるとの噂
プロセスが立つので、チェックしよう。

ps awux | grep -v grep | grep php

僕はこれでいけた。env反映。

ダメだった人はkillしよう。

kill プロセスID

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?