user9211168
user9211168

Reputation:

PHP: mysqli extension doesn't load

I try to use MySQL with PHP and I have this error:

Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in 'file_name Stack trace: #0 {main} thrown in 'file_name'`

When doing print_r( get_defined_functions()), I see that the MySQLi extension isn't there, but it is "loaded" in the php.ini file (I mean this is not in a commentary).

I specify that the PHP directory is in the PATH (I'm under windows) and MySQL, PHP and Apache are on my C: disk.

I don't know where is the problem, this is probably a small thing but I can't see which one so.

My versions are:

Apache 2.4.47
PHP 7.1.7
MySQL 5.7
Windows 7

PS : php_mysqli.dll do only 97k. I don't know if it's normal.

HOW I SOLVED THIS : I have just added extension_dir="path_to_php\ext" under the lines who load extentions, in the php.ini file. This line is used to indicate where are the extentions in your hard disk. Don't forget to restart your server, it will reload the php.ini file.

Upvotes: 2

Views: 5893

Answers (1)

jeprubio
jeprubio

Reputation: 18032

First of all, run phpinfo() to make sure you are looking at the correct php.ini.

If your php.ini file has extension=php_mysqli.dll uncommented check your extension directory. You may need to set it explicitly, like:

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

If the problem persists check the apache error log, you should find more info there.

Upvotes: 5

Related Questions