Home > Article > Backend Development > Why Does My Laravel App Give "Failed to Open Stream: Permission Denied" for 'file_put_contents(meta/services.json)'?
Failed to Open Stream: Permission Denied for 'file_put_contents(meta/services.json)'
While attempting to access a URL, you may encounter a "file_put_contents(meta/services.json): failed to open stream" error. This issue arises due to insufficient permissions in the 'app/storage' directory.
To resolve this error, follow these steps:
1. Change Permissions
Navigate to the 'app/storage' directory and grant it appropriate permissions using the 'chmod' command:
**For Laravel >= 5.4:** chmod -R 775 storage/ **For Laravel < 5.4:** chmod -R 775 app/storage
2. Clear Cache and Dump Autoload
After changing permissions, clear the Laravel cache and dump the autoload files:
php artisan cache:clear composer dump-autoload
Once completed, the error should be resolved, and you will be able to access the desired URL without issue.
The above is the detailed content of Why Does My Laravel App Give "Failed to Open Stream: Permission Denied" for 'file_put_contents(meta/services.json)'?. For more information, please follow other related articles on the PHP Chinese website!