Call to undefined function mysql_connect

To day I’m install php5 , apache and mysql, I dowload “php-5.2.6-Win32.zip”  installer packet and apache “apache_2.2.8-win32-x86-openssl-0.9.8g.msi” and then I’m download mysql server

1. Install apache  apache_2.2.8-win32-x86-openssl-0.9.8g.msi

2. Extract php-5.2.6-Win32.zip to c:\php\php5 ( I create new dir php5 contain php5 only).

3. Rename php.ini.dst to php.ini in c:\php\php5 then cut to c:\windows

4. Copy libmysql.dll in c:\php\php5 to c:windows\system32

5. Edit httpd.conf in  C:\apache2.2\conf\ add this line

# ==== Load Module PHP5 ======
LoadModule php5_module “C:/php5/php5apache2_2.dll”
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

6. Restart apache and create php.info() for test php installation.

7. Install Mysql Server and create file for test db.

<?php
$dbhost=”localhost”;
$dbuser=”root”;
$dbpassword=”1234″;
mysql_connect($dbhost,$dbuser,$dbpassword);
echo “Test MySQL”;
?>

After run this file error occur “Fatal error: Call to undefined function mysql_connect() in C:\apache2.2\htdocs\testDB.php on line 5

I’m back to php.ini and uncomment

extension=php_mysql.dll

You might also need to configure the extension_dir variable.

extension_dir = “C:\php\php5\ext”

Restart apache and run  execute file again

Leave a Reply