更新服务器后运行命令时出现此错误:
php artisan migrate:install
错误
<div class="Symbol" style="position:relative">
<img src="https//#" height="200" width="80"/>
</div>
<p>
text
</p>
打进了这个......
搜索很多,但没有得到解决方案
请大家帮帮忙
答案 0 :(得分:3)
请按以下步骤操作:
extension=php_pdo_mysql.dll
(如果您使用记事本,请使用 Ctrl + F )#
符号提示强>
您可以使用此命令php.ini
php -i | find /i "Configuration File"
文件
答案 1 :(得分:0)
错误找不到驱动程序-XAMPP中的PDO异常
请在PDO php中视为DSN
// dsn-数据源名称 $ dsn =“ mysql:host =”。$ this-> servername。“; dbname =”。$ this-> dbname。“; charset =”。$ this-> charset;
PDO中的数据库连接代码
<?php
class dbh
{
private $servername;
private $username;
private $password;
private $dbname;
private $charset;
public function connect()
{
$this->servername = "localhost";
$this->username = "root";
$this->password = "";
$this->dbname = "test";
$this->charset = "utf8mb4";
// dsn - data source name
$dsn = "mysql:host=".$this->servername.";dbname=".$this->dbname.";charset=".$this->charset;
try {
// PDO - Represents a connection between PHP and a database server.
$pdo = new PDO($dsn, $this->username, $this->password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // If any error occurrs catch function catch the errors.
return $pdo;
} catch (PDOException $e) {
// PDOException
echo "Connection failed: ".$e->getMessage(). '<br/>Code: '.$e->getCode();
// Exception::getMessage - gets the Exception message
}
}
}