Imported from my original Blogspot archive (2007–2010). Posts are preserved as originally written, including language, formatting, and mistakes.

I have Windows XP SP2 and installed IIS, one day I need make a website with PHP and MySQL, so I'm installed PHP 5.2.1 for Win32 and MySQL 5.0.27 for Win32. But I got a problem: the website PHP can't make connection with MySQL.

When PHP 5+, MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems path.

So, I opened php.ini in my PHP directory, used Cltr+F to find the keyword "php_mysql.dll" and I got this result:

;extension=php_mysql.dll

I was removed the ";":

extension=php_mysql.dll

Later, I was found "mysql.default_port" and modified his valor to my port(default: 3306), and I was found "mysql.default_host" and modified to "localhost":

; Default port number for mysql_connect().  If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
mysql.default_port = 3306
; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host = localhost