0

I've just upgraded PHP5.6 to PHP7 on my XAMPP on Windows 10 following this guide. It works just fine, except for PDO.

In my phpinfo() I get PDO support enabled, PDO drivers no value. I copied the php.ini-development and renamed it to php.ini, and I have uncommented the extension folder declaration, and the extention driver php_pdo_mysql.dll.

extension_dir = "ext"
...
extension=php_pdo_mysql.dll

I have verified that php_pdo_mysql.dll is located in C:\xampp\php\ext and when I run php -m in a console, both PDO and pdo_mysql are listed as active modules.

C:\xampp\php>php -m
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
filter
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mysqlnd
openssl
pcre
PDO
pdo_mysql
Phar
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib

[Zend Modules]

When I run a script that utilizes PDO, I get thrown Fatal error: Uncaught PDOException: could not find driver in (path to script)

The script I am running is completely valid and worked fine before the upgrade (basically just a new PDO(params)).

What am I missing?

Brian Emilius
  • 717
  • 1
  • 8
  • 31

1 Answers1

1

For some reason, not sure why, Windows needs an absolute path to the extension dir. So instead of

extension_dir = "ext"

in php.ini, I put

extension_dir = "C:/xampp/php/ext"

and then restarted apache. Everything works again.

Maybe someone can elaborate on this issue?

Brian Emilius
  • 717
  • 1
  • 8
  • 31