-2

PROBLEM DESCRIPTION :

No matter what code I put in login.php I always got this error :

Fatal error: Uncaught PDOException: could not find driver in 
C:\MAMP\htdocs\website\login.php:4 
Stack trace: #0 C:\MAMP\htdocs\website\login.php(4): PDO->__construct('C:\\Users\\neb\\...') #1 
{main} thrown in C:\MAMP\htdocs\website\login.php on line 4

I'm using MAMP I have installed php. When I check in the EV(Environment variables) it's in Path :\MAMP\htdocs\website\php8.2.4

So my php is actually php8.2.4 BUT the php of MAMP is 7.4.1 I don't know If it has something to do with the error.

CODE :

<?php
$fullname = "Adam";
echo "Hi $fullname and welcome on the website!";

?>

I also tried with :

<?php

phpinfo(); 

?>

But as I said earlier no matter what I put in login.php I got the same error

WHAT I'VE TRIED :

  1. check if php was installed with php --version in cmd
  2. install php
  3. change the directory of php

I still don't know how to solve this please help

EDIT

phpversion

I did replace php8.2 by php7.4.1 and Also restart MAMP But the error persist

EDIT 2 :

theimage

Meme410
  • 113
  • 9

1 Answers1

1

Firstly i recommend to create a test page and output the phpinfo there then check if the PDO extension is loaded. If theres no value then it seems that something is going on with your php.ini file.

  1. Check file here /Applications/MAMP/bin/php/phpx.y.z/conf/php.ini Source

  2. If you cant find the file there, look on another location and copy it there

  3. Restart MAMP

UPDATE:

Look in your php.ini' file and uncomment this line:

extension=php_pdo_mysql.dll

jmvcollaborator
  • 2,141
  • 1
  • 6
  • 17