Resolving "file_put_contents(meta/services.json): failed to open stream: Permission denied" Error
When attempting to access http://localhost/test/public/ and encountering the "Error in exception handler" message, several steps can be taken to diagnose and resolve the issue.
Step 1: Permission Modification
After verifying that debug is set to true in app.php, one may notice the following error: "The stream or file "/var/www/html/test/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied." To address this, run the command chmod -R 644 app/storage.
Step 2: Further Investigation
Upon resolving the previous error, a new one may appear: "file_put_contents(/var/www/html/laravel/app/storage/meta/services.json): failed to open stream: Permission denied."
Solution:
To resolve this issue, follow the steps suggested by vsmoraes:
For Laravel >= 5.4:
For Laravel < 5.4:
The above is the detailed content of How to Fix 'file_put_contents(): failed to open stream: Permission denied' Error in Laravel?. For more information, please follow other related articles on the PHP Chinese website!