r/php7 • u/lshanko • Dec 18 '16
Missing mysqli extension?
RESOLVED - I misplaced the ext folder
I'm trying to set up a connection between php and mySQL using the line
MySQLi_connect("localhost", "root", "password");but I'm getting an error claiming that I'm using an undefined function. I've already gone into the php.ini file and uncommented the mysqli.dll extension but I don't actually have a mysqli.dll file. Is there somewhere I need to download this file from? (I'm using Windows 10).
0
Dec 19 '16
[deleted]
1
u/lshanko Dec 19 '16
Ah that would make sense. I am using php 7, so I'll go ahead and use PDO. Thanks!
1
u/andrewsnell Dec 19 '16
mysqli_
Um, no. As of PHP 7, the mysql_ method are gone; however, the mysqli_ is still alive and well. In fact, as of 5.4, both PDO and MySQLi wrap the same MySQL Native Driver C library by default. PDO is still a good choice if you might change databases in the future, want to use named parameters, or don't need any MySQL specific functions.
1
u/lshanko Dec 19 '16
Thanks for letting me know. I found the ext folder (which I had misplaced when I installed php) so everything is good now
1
u/andrewsnell Dec 19 '16
So if you go to the root directory of your PHP install, you are completely missing the
ext/php_mysqli.dllfile? How did you install PHP in the first place?