php-src icon indicating copy to clipboard operation
php-src copied to clipboard

Call to undefined function mysqli_connect()

Open L-Ascorbic-acid opened this issue 4 years ago • 5 comments

Description

The following code:

<?php
	$link=mysqli_connect("localhost","root","root")or die("false to 
 connect".mysqli_connect_error());
	echo ("OK");
	?>

Resulted in this output:

Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in E:\connect.php:8 Stack trace: #0 {main} thrown in E:\connect.php on line 8

But I expected this output instead:

OK

PHP Version

PHP 8.1.4

Operating System

Windows 10

L-Ascorbic-acid avatar Apr 15 '22 05:04 L-Ascorbic-acid

You just need to enable the mysqli PHP extension.

raziel057 avatar Apr 15 '22 05:04 raziel057

您只需要启用 mysqli PHP 扩展。

I have delete the';'before extension=mysqli in php.ini,but didn't succeed.

L-Ascorbic-acid avatar Apr 15 '22 06:04 L-Ascorbic-acid

Check whether phpinfo(); reports that the mysqli extension is loaded.

if not, check the php.ini

staabm avatar Apr 15 '22 08:04 staabm

Also, make sure you restart your web server. And make sure you are changing the right ini file. There should be one for CLI and one for Apache.

kamil-tekiela avatar Apr 15 '22 10:04 kamil-tekiela

i can't able to ini file!! it saying that you do not have permission

bhuppidhamii avatar Jan 10 '23 14:01 bhuppidhamii