Solution for Laravel error file_put_contents(): failed to open stream

  1. Problem solution (the framework will generate a lot of temporary files during the running process) Execute the command php artisan cache:clear and give the /storage folder read and write permissions: chmod -R 777 storage;

If there is an error when executing php artisan cache:clear: Uncaught UnexpectedValueException: The stream or file "/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /vendor/monolog/monolog/src /Monolog/Handler/StreamHandler.php:87, you need to give /storage/log read and write permissions: chmod -R 777 storage/logs;

At this time, execute php artisan cache:clear again. If the error continues: [ErrorException] file_put_contents(/bootstrap/cache/services.php): failed to open stream: Permission denied, you need to give bootstrap/cache read and write permissions: chmod -R 777 bootstrap/cache;

Execute php artisan cache:clear again, if there is still an error: [PDOException] SQLSTATE[HY000] [1045] Access denied for user 'xxx'@'127.0.0.1' (using password: YES), you need to check whether laravel's database configuration is correct. 2. Refer to the error message in the laravel framework: file_put_contents(/): failed to open stream: Permission denied - Baidu Know

Laravel 5 migration error - stackoverflow

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324405414&siteId=291194637