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

semicolon24's avatar

Can anyone help with the error?

sorry, I want to ask, does anyone know why when I type the command php artisan optimize or php artisan config:cache on the hosting server an error appears like the following:

file_put_contents(/usr/share/nginx/html/name_web/bootstrap/cache/config.php): failed to open stream: Permission denied

Thank you for wanting to help

0 likes
4 replies
Snapey's avatar

your user cannot write to the file or directory

check your permissions and file ownership

semicolon24's avatar

@Snapey what should I do to fix this on the server? I can access this, I don't know what the steps are

Snapey's avatar

@semicolon24 run the command ls -ls storage in the root of your project and then advise what the directory listing looks like.

Please or to participate in this conversation.