使用 XAMPP Server Linux (Ubuntu) 在 Laravel 4 上迁移时找不到驱动程序

2022-01-14 00:00:00 xampp php pdo laravel-4 database-migration

我已经安装了 Laravel 4.1,一切正常,但是当我尝试使用迁移时,它会抛出一个 PDO 异常:

<块引用><块引用>

[PDO异常]找不到驱动程序

我在 StackOverFlow 上找到了很多答案,但不幸的是,没有一个能解决我的问题.

我尝试启用 pdo 扩展和 pdo_mysql 扩展,但它说 pdo 已经加载.我尝试重新安装 PDO 和 PDO MySQL,但没有任何效果.

我在 Ubuntu 64 位机器上使用 XAMPP 服务器.

提前谢谢你.

解决方案

问题解决了!

步骤:

  1. 卸载 XAMPP

  2. apt-get update &&apt-get install lamp-server^

  3. apt-get autoremove apache2

  4. apt-get remove --purge mysql-server mysql-client mysql-common

  5. apt-get autoremove &&apt-get 更新 &&apt-get install php5-mysql &&apt-get install pdo-mysql

  6. 安装 XAMPP

但是,我在运行 php artisan 时遇到了一个新问题,然后我发现我必须运行 /opt/lampp/bin/php artisan 而不是 php工匠

I have installed Laravel 4.1 everything worked just fine, but when I try to use migration it throws a PDO Exception saying:

[PDOException] could not find driver

I found many answers on StackOverFlow, but none of them solved my problem, unfortunately.

I have tried to enable pdo extension and pdo_mysql extension, but it says that pdo is already loaded. I have tried to reinstall PDO and PDO MySQL but nothing worked.

I am using XAMPP Server on a Ubuntu 64bit machine.

Thank you in advance.

解决方案

The problem is solved!

Steps:

  1. Uninstall XAMPP

  2. apt-get update && apt-get install lamp-server^

  3. apt-get autoremove apache2

  4. apt-get remove --purge mysql-server mysql-client mysql-common

  5. apt-get autoremove && apt-get update && apt-get install php5-mysql && apt-get install pdo-mysql

  6. Install XAMPP

However, I had a new problem with running php artisan then I discovered that I had to run /opt/lampp/bin/php artisan instead of php artisan

相关文章