5

My Laravel Project is working fine on localhost, but when I hosting this on cpanel and try to login or register. it's through me this error like could not find driver (SQL: select * fromuserswhereemail= [email protected] limit 1). What Should I do..??

5
  • Did you configure your environment using the .env file? What value did you use for DB_CONNECTION? Commented Aug 18, 2019 at 19:24
  • Yes, this my connection DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=nextnir_next DB_USERNAME=nextnir_nexto DB_PASSWORD=nextnir@next Commented Aug 18, 2019 at 19:27
  • 1
    Are you sure mysql is installed on that environment? Could you add a route that executes phpinfo(); to further debug this issue? Commented Aug 18, 2019 at 19:32
  • Actually I don't know how to install mysql on live server, and where I find this phpinfo(); ? Commented Aug 18, 2019 at 19:38
  • 1
    Possible duplicate of Laravel 5 PDOException Could Not Find Driver There are already plenty of this type of questions with correct answers that a simple research can find. Commented Aug 18, 2019 at 20:10

2 Answers 2

18

You probably didn't enable PDO extension. In your cpanel select

SOFTWARE > Select PHP Version

You see all extensions there, enable these extensions :

  • pdo
  • mysqlnd
  • ndmysqli
  • nd_pdo_mysql
Sign up to request clarification or add additional context in comments.

2 Comments

had almost the same problem, nd_pdo_mysql was not enabled by default in cPanel on the hosting server. Thanks @Mnikoei
Well done @Mnikoei
0

First of all, I want to thank all of you guys, I find another solution to solve this kind problem, What I have done just in my .htaccess file this line of code

# php -- BEGIN cPanel-generated handler, do not edit # Set the “ea-php71” package as the default “PHP” programming language. <IfModule mime_module> AddHandler application/x-httpd-ea-php71 .php .php7 .phtml </IfModule> # php -- END cPanel-generated handler, do not edit and change

DB_USERNAME=something DB_PASSWORD=something

and my problem is solved, this is enabled mysql also, Thank you guys Happy Coding....

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.