Tag Archives: file_put_contents failed to open stream

[How to Fix] file_put_contents failed to open stream

The following error occurred at runtime:

ErrorExceptioninFilesystem.php line 81:file_ put_ contents(/var/www/mysite/bootstrap/cache/services.json): failed to open stream: Permission denied

 

It can be seen from the above error that the cache directory does not have write permission, so write permission to this directory:

solution:

#sudochmod-R777/var/www/mysite/bootstrap/cache

The difference between permissions 777 and 755:

777 is that all users have execute, read and write permissions, 755 is that root can execute permissions. The user of the file and other group users do not have execute permissions