【发布时间】:2020-07-09 09:52:18
【问题描述】:
诚然,我是 Laravel 和后端开发的新手,但我试图在我的浏览器中打开一个 Laravel 项目,却收到一条错误消息。我从一个与另一组开发人员合作的客户那里继承了这个项目,他们已经离开了,所以我独自一人试图找出问题所在。
第一个错误消息是:
**Warning:** require(C:\xampp\htdocs\vizzue\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in **C:\xampp\htdocs\vizzue\bootstrap\autoload.php** on line **17**
**Fatal error:** require():Failed opening required 'C:\xampp\htdocs\vizzue\bootstrap/../vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in **C:\xampp\htdocs\vizzue\bootstrap\autoload.php** on line **17**
为了尝试修复该错误(通过我在此处找到的解决方案),我在终端中运行 composer install 以尝试下载丢失的文件。这将之前的错误消息切换为Whoops, looks like something went wrong.(不是很有帮助)。
因此,我在此处找到了更多建议,以获得针对我的问题的更详细错误,并在四个单独的标题下输出了一长串错误。
标题 1
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from `sessions` where `id` = hA02gV6ShpNslkw0N8Wrgm8QmyA0ZxoXfCNHsVTK limit 1)
标题 2
PDOException
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
标题 3
QueryException
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES) (SQL: select * from `sessions` where `id` = hA02gV6ShpNslkw0N8Wrgm8QmyA0ZxoXfCNHsVTK limit 1)
标题 4
PDOException
SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
我的 PHP 版本是:PHP 7.2.28
我的 Laravel 版本是:Laravel Framework 5.4.36
另外,我通过复制.env-example 文件创建了一个.env。
编辑:
我在database/migrations 目录中找到了数据库信息,因此我确实拥有数据库文件。但是,我仍然有错误。我跑了php artisan generate:key,这很好。但是当我运行php artisan migrate 时出现以下错误:
In Connection.php line 647:
could not find driver (SQL: select * from information_schema.tables where ta
ble_schema = homestead and table_name = migrations)
In Connector.php line 68:
could not find driver
【问题讨论】:
-
您的数据库凭据有误。检查你的 .env 文件!
-
我应该在问题中提到这一点,但我已经将 .env-example 复制到了 .env 文件中。数据库属性已经在我收到的项目中设置,但我没有在批量 laravel 文件中发送的数据库。这是造成问题的原因吗?
-
你能发布你的
config/database.php吗?我假设您已经 read the docs 配置您的数据库? -
如果你在终端/控制台运行
mysql --version,你用的是什么版本?