不知道问题出在哪里:
Illuminate\Database\QueryException
could not find driver (Connection: sqlite, SQL: PRAGMA foreign_keys = ON;)
at vendor\laravel\framework\src\Illuminate\Database\Connection.php:813
809▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
810▕ );
811▕ }
812▕
➜ 813▕ throw new QueryException(
814▕ $this->getName(), $query, $this->prepareBindings($bindings), $e
815▕ );
816▕ }
817▕ }
1 vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:65
PDOException::("could not find driver")
2 vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:65
PDO::__construct()
Script @php artisan migrate --ansi handling the post-create-project-cmd event returned with error code 1
<?php
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
// Bootstrap Laravel and handle the request...
(require_once __DIR__.'/../bootstrap/app.php')
->handleRequest(Request::capture());
解决步骤如果您使用的是 Windows,您可以访问以下链接:
如果您使用 GNU/Linux,您只需打开终端并写入以下内容:
php --ini
使用该命令,您将看到“php.ini”文件所在的位置,在我的例子中,它位于路径“/etc/php/php.ini”中。
我们以 root 用户身份打开文本编辑器,并在“php.ini”文件中查找以下内容:
;扩展名=pdo_sqlite
我们删除点并喜欢“;”取消注释,然后我们寻找:
;扩展名=sqlite3
我们还删除了分号“;”要取消注释,我们保存它并再次运行:
php artisan migrate
然后就可以毫无问题地运行命令了:
php artisan serve
但总而言之,在这两种操作系统中,您都必须搜索该文件来纠正错误,我希望它对您有用。