ashoor's avatar

file_put_contents(/var/www/html/.env): Failed to open stream: Permission denied

Hi,

file_put_contents(/var/www/html/.env): Failed to open stream: Permission denied 

i got this error when i run php artisan key:generate on production server

what shall i do

0 likes
3 replies
Sinnbeck's avatar

Sounds like your users does not have access to the folder. Is the user the same as the owner of the folder?

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@ashoor If you have sudo rights, you can do

sudo -u www-data php artisan key:generate

Please or to participate in this conversation.