I installed xampp to work on php projects, and I’m sure I installed it the same as in the course, but when I try to run a Development Server by running php -S localhost:8080
, it replies with
Fatal error: Uncaught PDOException: could not find driver in C:xampphtdocsphp-crash-course-202014_product_crud 2_betterpublicproductsindex.php:3 Stack trace: #0 C:xampphtdocsphp-crash-course-202014_product_crud 2_betterpublicproductsindex.php(3): PDO->__construct(‘mysql:host=loca…’, ‘root’, ”) #1 {main} thrown in C:xampphtdocsphp-crash-course-202014_product_crud 2_betterpublicproductsindex.php on line 3
I have done a lot of research and I think the problem is that there is no path to php.ini.
In php.ini I uncommented the extension pdo_mysql
but that didn’t work, so on the command line, I typed php --ini
and it replied with
Configuration File (php.ini) Path:
Loaded Configuration File: (none)
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
I have found the php.ini file in C:/xampp/php/php.ini
which from my research should be the right place, so I think I need to set a path for xampp to find php.ini, but I can’t find how.
Is there a command to set a path for php.ini?