Fatal error: Class 'mysqli' not found

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
menues
Forum Newbie
Posts: 3
Joined: Sun Nov 21, 2010 5:56 am

Fatal error: Class 'mysqli' not found

Post by menues »

Hey i am a newbie in PHP , was trying to access DB with following code

$db = new mysqli('localhost', 'root', 'XXXXXXX', 'YYYYYY');

i get the error Fatal error: Class 'mysqli' not found

i am using PHP Version 5.2.6 and php_mysqli.dll version 5.2.6.6

1. I checked for extension_dir C:\PHP\ext
2. extension=php_mysqli.dll is unset ( i e enabled) and dll is present in ext dir.

one of the forums i came across this code to check if mysqli dll is loaded

if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
echo 'We don\'t have mysqli!!!';
} else {
echo 'Phew we have it!';
}

when i run this code i get the message 'We don\'t have mysqli!!!';

restarted Mysql and apache

what am i doing wrong, Suggestions please , appreciate your help guys.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Fatal error: Class 'mysqli' not found

Post by social_experiment »

Which result do you get from the code sample below?

Code: Select all

<?php
 $dbc = mysqli_connect('you_host', 'your_username', 'your_password');
 if ($dbc) { echo 'Connected'; }
 else {
  echo 'Not connected';
 } ?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
menues
Forum Newbie
Posts: 3
Joined: Sun Nov 21, 2010 5:56 am

Re: Fatal error: Class 'mysqli' not found

Post by menues »

this is what i get Fatal error: Call to undefined function mysqli_connect()
menues
Forum Newbie
Posts: 3
Joined: Sun Nov 21, 2010 5:56 am

[Solved]Re: Fatal error: Class 'mysqli' not found

Post by menues »

1. Viewd the dependencies for mysqli via Dependency Walker ( thank you very much ...great tool) libmysql dll was missing ..added the dll to system32 folder .now it works
Post Reply