php artisan migrate throwing [PDO Exception] Could not find driver - Using Laravel

后端 未结 26 1409
眼角桃花
眼角桃花 2020-12-01 07:41

I have a bad experience while installing laravel. However, I was able to do so and move to the next level. I used generators and created my migrations. But when I type the

相关标签:
26条回答
  • 2020-12-01 07:54

    I'm unsing ubuntu 14.04

    Below command solved this problem for me.

    sudo apt-get install php-mysql

    In my case, after updating my php version from 5.5.9 to 7.0.8 i received this error including two other errors.

    errors:

    1. laravel/framework v5.2.14 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.

    2. phpunit/phpunit 4.8.22 requires ext-dom * -> the requested PHP extension dom is missing from your system.

    3. [PDOException]
      could not find driver

    Solutions:

    I installed this packages and my problems are gone.

    sudo apt-get install php-mbstring

    sudo apt-get install php-xml

    sudo apt-get install php-mysql

    0 讨论(0)
  • 2020-12-01 07:54

    first check your php version like this :

    php -v
    

    after you get version number for example i get 7.1 then install like that

    sudo apt-get install  php7.1-sqlite     //for laravel testing with sqlite
    sudo apt-get install  php-mysql         //for default mysql
    sudo apt-get install  php7.1-mysql      //for version based mysql 
    sudo apt-get install  php7.1-common     //for other necessary package for php
    

    and need to restart apache2

    sudo service apache2 restart
    
    0 讨论(0)
  • 2020-12-01 07:54

    For future searchers. On FreeBSD try the next

    pkg_info | grep php5-pdo_mysql
    

    if you see the empty line in return do the following:

    cd /usr/ports/databases/php5-pdo_mysql
    

    and the do the install

    make install clean
    

    then simply restart your apache and you are done

    e.g. sudo /usr/local/etc/rc.d/apache22 restart

    0 讨论(0)
  • 2020-12-01 07:56

    I got this error for the PostgreSQL and the solution is:

    sudo apt-get install php7.1-pgsql
    

    You only need to use your installed PHP version, mine is 7.1. This has fixed the issue for PostgreSQL.

    0 讨论(0)
  • 2020-12-01 07:56

    just replaced: ;extension=pdo_mysql to extension=pdo_mysql in php.ini file.

    0 讨论(0)
  • 2020-12-01 07:57

    You can use

    sudo apt-get install php7-mysql
    

    or

    sudo apt-get install php5-mysql
    

    or

    sudo apt-get install php-mysql
    

    This worked for me.

    0 讨论(0)
提交回复
热议问题