PHP Error: "Call to undefined function mysqli_connect()"
Asked Answered
C

3

5

In PHP I'm getting this error:

Call to undefined function mysqli_connect()

I checked my php.ini file and there is no ; in front of extension=php_mysql.dll or extension=php_mysqli.dll.

I think the I am getting this error because my figuration File (php.ini) Path is C:\Windows. How would I change it to C:\Apache2.2\php\php.ini?

Condign answered 18/4, 2011 at 15:14 Comment(1)
Possible duplicate of Fatal error: Call to undefined function mysqli_connect()Felder
G
9

On Ubuntu machines you can try:

sudo apt-get install php5-mysql

since the basic PHP5 install does not include the mysqli_connect function.

Genro answered 16/7, 2013 at 18:33 Comment(2)
you migth need to restart the apache2 server sudo service apache2 restartScholem
Thank you P Mag and @Qualphey! I thought I restarted this a while ago but must have forgot.Hamlett
Q
1

You can set the path using PHPIniDir in .htaccess or your server config.

ie.

PHPIniDir "C:/Apache2.2/php"

You won't have to recompile PHP if the extension gets loaded correctly (so make sure your extension_dir is correct), just make sure you restart Apache after you made these changes.

Quinonez answered 18/4, 2011 at 15:20 Comment(0)
S
0

You need to recompile PHP with the extension for this library.

Simons answered 18/4, 2011 at 15:15 Comment(2)
can you explain that a little more? What do I need to do to recompile?Condign
Recompilation is not necessary. You can just take binary module and turn it on in php (in dynamic manner).Snicker

© 2022 - 2024 — McMap. All rights reserved.