PHP + Windows – Call to undefined function mysql_connect()

Install WordPress and hits the following error message :

Fatal error: Uncaught Error: Call to undefined function mysql_connect() 
	in C:\nginx-1.12.1\www\wordpress\wp-includes\wp-db.php...


  1. PHP 7.1.10
  2. WordPress 4.8.3
  3. Nginx 1.12.1
  4. MySQL 5.7.17
  5. Windows 10


To install WordPress, PHP needs Mysql extension, to fix this, loads php_mysqli.dll in php.ini file.


; Directory in which the loadable extensions (modules) reside.
; extension_dir = "./"
; On windows:
; extension_dir = "ext"

extension_dir = "ext"

;extension=php_exif.dll      ; Must be after mbstring as it depends on it


;extension=php_oci8_12c.dll  ; Use with Oracle Database 12c Instant Client

On Windows, default PHP dll extensions, including php_mysqli.dll are stored in the c:\\your-php-path\\ext folder, make sure the extension_dir path is pointing to the correct folder.

Restart PHP, done.


  1. PHP php_mysqli.dll
  2. PHP extension_dir
author image


Founder of, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities. Read all published posts by


newest oldest most voted
Aditi Phadnis
Aditi Phadnis

Hi, Can you help me with this error. I am facing the error on one of the NGO websites