Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5.4 Migration Error

Tags:

laravel-5.4

I am facing a issue that I cannot resolve. I have my app hosted on my server using Ubuntu 16.04, PHP 7.1, MySQL and NGINX. My app works perfect. When I ssh to my server and app root I run the following, php artisan session:table, it runs successfully.

When i run php artisan migrate I get foll0wing error and table is not created in my DB.

[Illuminate\Database\QueryException]                                         
  could not find driver (SQL: select * from information_schema.tables where t  
  able_schema = UNIT3D and table_name = migrations)                            

  [PDOException]         
  could not find driver 

Any ideas? Im trying to use this.https://github.com/thomastkim/laravel-online-users

like image 663
HD Vinnie Avatar asked Feb 10 '17 19:02

HD Vinnie


1 Answers

I would start by determining the exact php modules installed. This can be accomplished by

php -m

look for 'phpX.Y-mysql', if you do not see it then the php module is NOT installed. (Where X.Y correspond to your php version number.

Assuming that you do not see it, you can find the exact package version to install from the repos by typing:

sudo apt-cache search php-mysql

Your results will be similar to:

sudo apt-cache search php-mysql
php-mysql - MySQL module for PHP [default]
php7.0-mysql - MySQL module for PHP
php5.6-mysql - MySQL module for PHP
php-mysqlnd-ms - MySQL replication and load balancing module for PHP
php7.1-mysql - MySQL module for PHP

Install the proper php module for your version. Ex:

sudo apt-get install php7.1-mysql
like image 106
john Avatar answered Jan 03 '23 17:01

john