douju8113
douju8113
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_firebird.dll
    ;extension=php_pdo_mssql.dll
    ;extension=php_pdo_mysql.dll
    ;extension=php_pdo_oci.dll
    ;extension=php_pdo_odbc.dll
    extension=php_pdo_pgsql.dll //In my Case the extension enable is for pgsql
    ;extension=php_pdo_sqlite.dll
    

    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: ;extension=extension.so to extension=extension.so

    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

    http://laravel.com/docs/5.1/homestead

    点赞 评论

相关推荐