user14339690
user14339690

Reputation:

In Laravel - could not find driver on xampp using ubuntu 16.04

I am working on xampp 7.3 version of PHP. I am facing the below error.

Illuminate\Database\QueryException: could not find driver (SQL: select name from table where id = e690ddc2-a2b6-4aad-8a73-dab1771c0ea6 limit 1) in file /opt/lampp/htdocs/ProjectFolder/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 669

Also, I have uncommented the pdo_mysql.dll in php.ini file it still giving me an error. Also, it is working in the windows system but not in Ubuntu16.04.

how can solve this?

Upvotes: 0

Views: 1166

Answers (2)

Marvin Dawson
Marvin Dawson

Reputation: 69

I resolve this issue on Ubuntu 18.04 by:

  1. "Control C" out of the php artisan serve command to stop the application.
  2. Stop all the servers running on XAMPP -> (Apache, MySQL and ProFTPD).
  3. Enable mysql inside of XAMPP via path $ cd /opt/lampp/etc .
  4. $ sudo nano php.ini or open in your choice of text editor. I use PHPStorm.
  5. Search for "php_mysql.dll".
  6. Removed the ";" in front of ";extension=php_mysql.dll" -> hit save.
  7. Back in the terminal -> $ cd.. back one folder into the /opt/lampp.
  8. Run $ sudo apt-get install php*-mysql. -> Could take a couple minutes based on your internet connection.
  9. After the install is complete -> restart all the XAMPP servers.
  10. Run $ php artisan config:cache.
  11. Run $ php artisan serve.

Upvotes: 0

mateonunez
mateonunez

Reputation: 197

You should install the necessary packages

sudo apt-get install php*-mysql

Then uncomment the MySQL extensions on php.ini and restart your server

sudo service apache2 restart

In your project set the correct parameters and in the root of your project run

php artisan config:cache

Upvotes: 2

Related Questions