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...
Tested
- PHP 7.1.10
- WordPress 4.8.3
- Nginx 1.12.1
- MySQL 5.7.17
- Windows 10
Solution
To install WordPress, PHP needs Mysql extension, to fix this, loads php_mysqli.dll
in php.ini
file.
php.ini
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "ext"
extension_dir = "ext"
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_exif.dll ; Must be after mbstring as it depends on it
extension=php_mysqli.dll
;extension=php_oci8_12c.dll ; Use with Oracle Database 12c Instant Client
;extension=php_openssl.dll
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.
Hi mkyong.com, Can you help me with this error. I am facing the error on one of the NGO websites loksadhana.org