Problem in connecting MySQL with PHP

I am trying to create a connection to MySQL with PHP using
mysqli_connect(‘localhost’, ‘root’, '**'); // shows password//
but it is giving “Fatal error: Call to undefined function mysqli_connect()”

what should I do or check???

Ensure the mysqli extension has been enabled in the php.ini file, if its not simply remove the # from the start of the line and save the file.

Yes it is enabled in
I have tried to explore it a little bit more and what i have encountered is:
mysql is not enabled on my php installation
coz when i run phpinfo() it is not giving any info of mySQLi.
I have followed each step carefully from “BUILD YOUR OWN DATABASE DRIVEN WEB SITE USING PHP & MYSQL” book
Moreover i am giving the software versions i have installed (in case if it can help anyway)
Windows 7 Home premium
Apache ver 2.2.21
MySQL ver 5.5.17

Looking Forward for a quick solution coz its really exhausting now !!!

  • Check your extension directory is correctly set in php.ini
  • Check mysql.dll file exists in your extension directory.
  • Check if it is really enabled (no semicolon ; at the beginning).
  • Once you enable if not enabled, don’t forget to restart your web service (apache).

Extension directory is correct at extension_dir = “C:/PHP/ext”
Yes mysql.dll and mysqli.dll both are in extension directory
And both are enabled in php.ini
And i have stopped and started it

Have a read of the following post as it may help you.

try to use following syntax
$dbhost = ‘localhost’;
$dbuser = ‘root’;
$dbpass = ‘password’;

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die (‘Error connecting to mysql’);

$dbname = ‘petstore’;

Thank you all
my problem is solved

Good to hear, could you please just as a reference let everyone else know how you fixed it.