Could not find driver while migrating on Laravel 4 using XAMPP Server Linux (Ubuntu)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 07:01:40

问题


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.


回答1:


If you are looking for simple solution, I had same issue & this worked for me..

When you run php artisan from terminal, you invoke php5-cli package.

To run artisan with XAMPP's php you need to use:

/opt/lampp/bin/php artisan migrate

But make sure your /opt/lampp/etc/php.ini is properly configured to enable pdo_mysql




回答2:


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



来源:https://stackoverflow.com/questions/24533644/could-not-find-driver-while-migrating-on-laravel-4-using-xampp-server-linux-ubu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!