I am new to php and am learning it from "Build Your Own database driven web site using Php and MySql".
I get the following error when i run the below code.
$link = mysqli_connect('127.0.0.1', 'root', 'mypassword');
Fatal error: Call to undefined function mysqli_connect() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\connect\index.php on line 2
I am using apache http server 2.2 and php 5.4.11 and operating system is Windows 7. (I have installed php and mysql separately and not used Wamp server). I am able to connect to mysql from command prompt.
I have read enormous number of threads related to the same error(some on this very site). Still am unable to successfully run the code.
I have checked the following points:
File - php.ini
i) doc_root = C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs
ii) extension_dir = "C:\php\ext"
iii) extension=php_mysqli.dll (uncommented)
In the file - C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf i have added
LoadModule php5_module "C:/PHP/php5apache2_2.dll"
AddType application/x-httpd-php .php
Also i have learned that php 5.3+ does not need extra setup configurations with mysql due to Mysql native driver(mysqlnd). Yet however i have added the path of directory containing libmysql.dll and the directory containing php.ini in the System Path and restarted the computer.
I have also run the command phpinfo(INFO_MODULES) and I find mysqlnd enabled but there is no mention of mysqli. I have also confirmed that i am editing the correct php.ini file. What am I actually missing?
Any help/ guidance appreciated