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

后端 未结 26 1407
眼角桃花
眼角桃花 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:58

    I was also getting the same error --> "[PDOException] could not find driver "

    I realized that the php was pointing to /usr/bin/php instead of the lampp /opt/lampp/bin/php so i simply created and alias

    alias php="/opt/lampp/bin/php"

    also had to make update to the .env file to ensure the database access credentials were updated.

    And guess what, it Worked!

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

    You are missing a PDO driver.

    First install the driver

    For ubuntu: For mysql database.

    sudo apt-get install php5.6-mysql/php7.2-mysql

    You also can search for other database systems.

    You also can search for the driver:

    sudo apt-cache search drivername

    Then Run the cmd php artisan migrate
    
    0 讨论(0)
  • 2020-12-01 07:59

    If you are using arch based system like in manjaro

    just use

    sudo pacman -S php-sqlite
    

    Restart your httpd

    systemctl restart httpd
    
    0 讨论(0)
  • 2020-12-01 08:02

    Had the same issue and just figured, website is running under MAMP's php, but when you call in command, it runs mac's(if no bash path modified). you will have issue when mac doesn't have those extensions.

    run php -i to find out loaded extensions, and install those one you missed. or run '/Applications/MAMP/bin/php/php5.3.6/bin/php artisan {your command}' to use MAMP's

    0 讨论(0)
  • 2020-12-01 08:06

    This worked for me:

    sudo apt-get install php5-sqlite
    

    This installed sqlite for php5, then I ran the php artisan migrate command again and worked perfectly.

    0 讨论(0)
  • 2020-12-01 08:06

    This worked with me:(for pgsql: use 'pgsql' instead of 'mysql')

    Step 1)

    sudo apt-get install php-mysql
    

    Step 2)

    php artisan config:clear
    

    Step 3)

    php artisan config:cache
    

    Step 4)
    Then restart your server, and generate key again and migrate it, Its Done

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