Laravel: PDOException: could not find driver

前端 未结 21 2359
野趣味
野趣味 2020-11-27 05:06

I am developing a website on a server I only have access to MySQL and FTP, so all commands I run are through the b374k php shell . I am experiencing a Laravel problem with S

相关标签:
21条回答
  • 2020-11-27 05:50

    Your database driver is missing. To solve the probelm

    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-11-27 05:50

    In window OS. I have uncomment extension=pdo_mysql for php.ini file that locate at same directory of php.exe. after that it work fine.

    0 讨论(0)
  • 2020-11-27 05:54

    You are probably missing sqlite or the specific DB driver you are trying to migrate.

    Install the DB driver and you'd be fine. You don't necessarily need to edit your php.ini file (it's one way to fix it too though).

    For sqlite do --> sudo apt-get install php-sqlite3 Then php artisan migrate

    NB: I assume you have PHP and MySql already installed

    0 讨论(0)
  • 2020-11-27 05:55

    ERROR: could not find driver (SQL: select * from tests where slug = a limit 1)

    I was getting the above error in my laravel project, i am using nginx server on ubuntu 16.04

    This error is because, php-mysql driver is missing. To install it type following command.

    sudo apt-get install php7.2-mysql
    

    Please specify your current php version in above command.

    Open php.ini file and uncomment the followling line of code(Remove Semicolon).

    ;extension=pdo_mysql
    

    Then Restart the nginx and php service

    sudo systemctl restart php7.2-fpm
    sudo systemctl restart nginx
    

    It worked for me.

    0 讨论(0)
  • 2020-11-27 05:55

    In my case I'm using Ubuntu so I found that my system is not installed php-sqlite3, after installation its got fixed.

    sudo apt-get install php7.2-sqlite3

    0 讨论(0)
  • 2020-11-27 05:56

    I got the same error when running my test suite. It was working before but it stopped working after I upgraded php. So I did

    sudo apt-get install php-sqlite3
    

    and it worked.

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