简体   繁体   English

Laravel 5迁移错误

[英]Laravel 5 migration error

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 . 然后,我通过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 然后我回来尝试运行迁移,并且使用php artisan migrate migration引发以下错误

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 PHP致命错误:无法打开消息“流或文件“ /opt/lampp/htdocs/laravel/storage/logs/laravel.log”的未捕获异常'UnexpectedValueException':/ 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. 我在Google上搜索后发现composer dump-autoload正常工作,但事实并非如此, composer dump-autoload引发了相同的错误。

php artisan migrate:reset throws the same error as php artisan migrate:reset . php artisan migrate:reset引发相同的错误php artisan migrate:reset

Thanks 谢谢

Change Permission of log folder of laravel 更改laravel日志文件夹的权限

Give Read & Write permission 授予读写权限

storage/logs

Changing Database: 更改数据库:

1: Change DB name in config/database.php 1:在config / database.php中更改数据库名称

2: root/.env DB_DATABASE=databasename 2: root/.env DB_DATABASE=databasename

It's not the problem of autoloading. 这不是自动加载的问题。 It is a problem of file permissions. 这是文件权限的问题。 Check if webserver can write to the storage/logs directory. 检查Web服务器是否可以写入storage/logs目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM