how to install mysqli on windows iis server?

2019-05-28 22:23发布

问题:

I am trying to run mysqli on my remote windows server and I keep getting this error

Fatal error: Call to undefined function mysqli_connect()

I assume mysqli is not installed on my remote server. So how do I install mysqli on my remote server.

回答1:

mysqli is a PHP extension. So all you have to do is enable that extension in your php.ini file.

Uncomment:

;extension=php_mysqli.dll

To:

extension=php_mysqli.dll

If using a share hosting account, you may have to create a .htaccess and point it to your own copy of php.ini.

To do that, you could try the following:

  • If php is installed as a module: In your .htaccess put SetEnv PHPRC /location/todir/containing/phpinifile

  • If php is installed as a cgi extension, put your php.ini in the cgi-bin folder.

  • For some hosts, you can also just put your php.ini in the folder where you would usually put your .htaccess files.



回答2:

(Working on windows)

I was facing exactly the same issue.

In my case, the problem was that I had saved the php.ini file as a text file. As soon as I converted the text file to "All Files" in notepad and gave it the ".ini" extension, it became a "Configuration Settings File" and it worked.

You may check if this is the case by going through the loaded configuration file row in phpinfo(). If the value is 'none', you may be facing a similar issue.

Note: I had already uncommented the extensions and fixed the extension directory.