添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Hi guys, I have good knowledge of the fundamentals of web stack - html, css, js, php. Currently I am trying to learn and understand laravel framework in php.

I started a new laravel project and am configuring the .env file. I ran command php artisan key:generate, it says key has been generated but it is not showing next to APP_KEY in the .env file.

Any help please, I tried chat gpt but couldn't solve this.

hi somehow I managed to solve this, maybe by luck.

I downloaded open SSL which is open source and ran this command in cmd openssl rand -base64 32

this effectively runs and spits out an app key that you can use. I then copied and pasted this app key into the .env file in my laravel project. I then went and saved it but I accidentally saved the .env file as env.txt so this created another file in my project. After deleting this plain text env file, I noticed that the normal app key generated by php artisan magically appeared in my original .env file ;)

Pretty good, maybe a solution others can use to fix this issue if they run into problems with this.

I never had this problem, even tried this now through composer create-project ... which I haven't used for a long time - works just as fine as the Laravel Installer (actually even better than it used to be, not as good as the installer though). Tell us how exactly we can reproduce it.
For example, have you either used the installer ( laravel new example-app ) or composer create-project laravel/laravel example-app ?
Which PHP version do you use?

php artisan key:generate --show

and copy-paste it.

In case it won't help just use this, don't use it in your production server though:

APP_KEY=base64:cIAZm9N4b/jlWLNm55/18PbcKN9lny36KiE0t3Ox4YI=

VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

my OS is windows 10.

hi somehow I managed to solve this, maybe by luck.

I downloaded open SSL which is open source and ran this command in cmd openssl rand -base64 32

this effectively runs and spits out an app key that you can use. I then copied and pasted this app key into the .env file in my laravel project. I then went and saved it but I accidentally saved the .env file as env.txt so this created another file in my project. After deleting this plain text env file, I noticed that the normal app key generated by php artisan magically appeared in my original .env file ;)

Pretty good, maybe a solution others can use to fix this issue if they run into problems with this.