0
votes

I was using migration with a database. Then i removed that database and created new one. Then i created migration files from the terminal via php artisan make:migration create_users.

Then i came back and tried to run the migration and it throws the following error with php artisan migrate

Error:

PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/opt/lampp/htdocs/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /opt/lampp/htdocs/laravel/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:95

And also a few more.

I googled and found that composer dump-autoload wil work, But it didn't and composer dump-autoload throws the same error.

php artisan migrate:reset throws the same error as php artisan migrate:reset.

Thanks

2
Problem with laravel log. give read and write permission to storage/logs/Prashant Srivastav
i set the permissions correctly now it throws error [PDOException] SQLSTATE[HY000] [1049] Unknown database 'firstapp' i deleted firstapp database before and now in config/database.php file have fts_laravel database and it is correct . Any idea ?Gammer
firstapp database is not existPrashant Srivastav
yes firstapp database does not exists and i have now fts_laravel which is correct in config/database.php file.Gammer
Oh yeahhhhhh ! Thanks buddy !Gammer

2 Answers

3
votes

Change Permission of log folder of laravel

Give Read & Write permission

storage/logs

Changing Database:

1: Change DB name in config/database.php

2: root/.env DB_DATABASE=databasename

0
votes

It's not the problem of autoloading. It is a problem of file permissions. Check if webserver can write to the storage/logs directory.