1

So, I'm trying to use a table in a php program and I got a fatal error (class mysqli not found) which after researching on stackoverflow means I don't have extension=php_mysqli.dll enabled (here's the php-website which talks about enabling it: http://php.net/manual/en/install.windows.extensions.php.)

But I looked in my php.ini file and the sort of ";extension=..." lines that it talks about commenting aren't there (I did ctrl + f to search through as well as manually searching through). I tried just adding the "extension=php_mysqli.dll" line but it still didn't work.

Someone else also said you need to uncomment the extension_dir line in php.ini and specify my location but that line only appears in an if loop in php.ini and it's not commented out. (from this stackoverflow question: Fatal error: Class 'MySQLi' not found).

How do I add "extension=php_mysqli.dll" to my php.ini file so my php program can create a mysqli table?

Community
  • 1
  • 1
user3505195
  • 33
  • 1
  • 1
  • 8

2 Answers2

1

If you don't have mysqli extension in you php version you should download another version of PHP.

http://windows.php.net/download/

Get PHP 7 OR PHP 5.6 last version (thread safe recommended).
After, following the instructions on this page http://php.net/manual/en/install.windows.extensions.php to activate mysqli extension.

;extension=php_exif.dll
extension=php_mysqli.dll  // Uncomment this line
;extension=php_oci8_12c.dll

You can define the path of your php extensions folder if you have problems. To do this, uncomment line extension_dir.

extension_dir = "C:\php\ext" // Your ext folder path

Restart your apache / nginx and try to use mysqli functions.

Hope this will can help you.

TiTnOuK
  • 174
  • 1
  • 9
  • I downloaded the thread safe version of PHP 7 and I had two php.ini files (php.ini-development and php.ini-production). I edited the code in both to be `;extension=php_exif.dll extension=php_mysqli.dll ;extension=php_oci8_12c.dll` And made the path for each `extension_dir="C:\Users\Mike\Desktop\php" ` which is where my php.ini files are but it's still not working. – user3505195 Apr 30 '16 at 20:21
  • 2
    Rename php.ini-development to php.ini and for your extension_dir you have to put this: "C:\Users\Mike\Desktop\php\ext". Restart web server and try again after that. – TiTnOuK Apr 30 '16 at 20:53
  • I did those and WAMP (which is what I'm using for my server) has mysql and mysqli with a green check under extensions but I still get the fatal error and the code snippet I run returns we don't have mysql :/ Thanks for all the help though – user3505195 May 01 '16 at 01:11
0

In my case, I had the extension=mysqli set in my php.ini and the php_mysqli.dll file in the php/ext folder, I just had to uncomment (remove the ;) the extension_dir line in php.ini:

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
;extension_dir = "./"
; On windows:
extension_dir = "ext"

Save php.ini and restart php and the webserver.

kefs
  • 3,606
  • 4
  • 21
  • 25