2015-09-04 14:10
浏览 44

php artisan migrate - Laravel

As soon, i press Enter 'php artisan migrate' command on ubuntu terminal. Error coming like:- [PDOException] Could Not Find Driver

I'm not able to fix this problem as i'm new to it.

Please help me to fix this issue.

enter image description here enter image description here

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • doutuo7126
    doutuo7126 2015-09-07 15:11

    I made changes in "Project-Folder-Name/config/database.php". And, it worked. Added 'unix_socket' => '/opt/lampp/var/mysql/mysql.sock',

    'mysql' => [
                'driver'    => 'mysql',
                'host'      => env('DB_HOST', 'localhost'),
                'database'  => env('DB_DATABASE', 'DatabaseName'),
                'username'  => env('DB_USERNAME', 'root'),
                'password'  => env('DB_PASSWORD', ''),
            'unix_socket'   => '/opt/lampp/var/mysql/mysql.sock', //Your sock got from above
                'charset'   => 'utf8',
                'collation' => 'utf8_unicode_ci',
                'prefix'    => '',
                'strict'    => false,
    点赞 评论
  • doukuo9116
    doukuo9116 2015-09-04 14:48

    Yo should be enable the PDO extension for you Database Manager in you php.ini

    extension=php_pdo_pgsql.dll //In my Case the extension enable is for pgsql

    For enable you should delete the ; char in the line of the extension restart the server and voila

    点赞 评论
  • dongtaotao19830418
    dongtaotao19830418 2015-09-07 15:17

    I think you have a seperated configuration file (php.ini) for your CLI.

    Try to execute php -i | grep php.ini in your console. And enable the required modules in that file.

    It should return something like this:

    sander@sander-Laptop:~$ php -i | grep php.ini
    Configuration File (php.ini) Path => /etc/php5/cli
    Loaded Configuration File => /etc/php5/cli/php.ini

    As you can see it uses another php.ini file then what the phpinfo(); returns

    Open that file and enable the required extensions there

    so change the lines of the extensions that you require: ; to

    Also a tip: If you use Laravel you can use the Homestead (vagrant, virtualbox) which is an virtual machine complete preinstalled for you laravel application

    点赞 评论