Search code examples
laravellaravel-5.3

How to issue "could not find driver" in Laravel 5.3?


I create my project with Laravel 5.3 in localhost, after create I upload project in VPS, but after upload this error shows:

enter image description here

In localhost: PHP version is: 7.0, OS: Ubuntu 16.04,

In VPS: PHP version is: 7.0, OS: Ubuntu server 16.04 and Mysql is not install (The other server's database).

.env file in VPS:

DB_CONNECTION=mysql
DB_HOST=192.168.19.51
DB_PORT=3306
DB_DATABASE=flight
DB_USERNAME=*****
DB_PASSWORD=*****

Do I need to change the PHP or VPS or Laravel`?

EDIT 1:

config/database.php:

'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', 'localhost'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
        'strict' => false,
        'engine' => null,
    ],

Solution

  • PHP PDO Extension is not installed on VPS. Check this answer PDOException “could not find driver”

    Just run on VPS

    sudo apt-get install php7.0-mysql