-1

I deployed my Laravel project on Cpanel but there's an error "could not find driver(SQL)"

I'm using Mysql database in Cpanel, and I have checked pdo_mysql in PHP extension.

but when I looked on

phpinfo(); and find pdo_mysql, the result is 0/0

How to fix this?

Thanks in advance

Arti Patel
  • 671
  • 4
  • 15
kyurie
  • 15
  • 6
  • what are the .env variables for you database connection? – Gert B. Oct 21 '21 at 05:36
  • DB_CONNECTION=mysql DB_HOST=local DB_PORT=3306 DB_DATABASE=[DB_DATABASE](correct) DB_USERNAME=[DB_USERNAME](correct) DB_PASSWORD=[DB_PASSWORD](correct) – kyurie Oct 21 '21 at 06:07
  • Did you enable pdo, pdo_mysql and pdo_sqlite ? I have mysqlnd checked too on my cpanel php settings. (not sure if thats needed) – Gert B. Oct 21 '21 at 06:13
  • yes, it's checked on my PHP Extension. but still I have the same error. – kyurie Oct 21 '21 at 06:15
  • Welcome to SO. Please try to research your problem before posting a question. I searched for your exact error message, and found many answers, [example1](https://stackoverflow.com/q/2852748/6089612). I searched for "*enable PDO cpanel*" and found many more answers. If you have already seen those and tried the posted solutions, and are still having problems, update your question and describe what you tried, and what happened. – Don't Panic Oct 21 '21 at 07:34
  • Does this answer your question? [PDOException “could not find driver”](https://stackoverflow.com/questions/2852748/pdoexception-could-not-find-driver) – Don't Panic Oct 21 '21 at 07:34
  • thank you for comment. I already search that, and after hours and hours of searching of solutions still not work for me and here I am, hehe, – kyurie Oct 21 '21 at 08:12
  • If you have already seen those and tried the posted solutions, and are still having problems, update your question and describe what you tried, and what happened. How can anyone help you if you don't tell us what you've tried? – Don't Panic Oct 21 '21 at 09:37

1 Answers1

0

Thanks for your reply. The culprit is my PHP version which is 7.3. then when I change it to 7.4 out of nowhere. It works like magic.

I change my .htaccess in Cpanel from

<FilesMatch "\.(php4|php5|php7|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php73
</FilesMatch

to

<FilesMatch "\.(php4|php5|php7|php3|php2|php|phtml)$">
SetHandler application/x-httpd-alt-php74
</FilesMatch>
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
kyurie
  • 15
  • 6