admin管理员组

文章数量:1122832

Trying to install wordpress without xamp on my local machine. Version info:

Wordpress: 5.2.3
PHP: 7.3.9
Apache: 2.4.41 

When accessing this url -http://localhost:8080/wordpress/wp-admin/install.php, I see the following in wordpress logs:

[16-Sep-2019 18:47:34 UTC] PHP Fatal error:  Uncaught Error: Call to 
undefined function mysql_connect() in C:\apps\httpd-2.4.41-win64- 
VS16\Apache24\htdocs\wordpress\wp-includes\wp-db.php:1643

I tried the solutions available online but I still see the error.

Solutions I tried so far:

Add the following to my wp-config.php:

define( 'WP_USE_EXT_MYSQL', true);

Added following to php.ini:

extension_dir = "ext"
extension=php_mysqli.dll

This is my phpinfo:

Server API  Apache 2.0 Handler
Virtual Directory Support   enabled
Configuration File (php.ini) Path   C:\windows
Loaded Configuration File   C:\apps\php-7.3.9\php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed    (none)
PHP API 20180731
PHP Extension   20180731
Zend Extension  320180731
Zend Extension Build    API320180731,TS,VC15
PHP Extension Build API20180731,TS,VC15
Debug Build no
Thread Safety   enabled
Thread API  Windows Threads
Zend Signal Handling    disabled
Zend Memory Manager enabled
Zend Multibyte Support  disabled
IPv6 Support    enabled
DTrace Support  disabled
Registered PHP Streams  php, file, glob, data, http, ftp, zip, compress.zlib, phar
Registered Stream Socket Transports tcp, udp
Registered Stream Filters   convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*

Trying to install wordpress without xamp on my local machine. Version info:

Wordpress: 5.2.3
PHP: 7.3.9
Apache: 2.4.41 

When accessing this url -http://localhost:8080/wordpress/wp-admin/install.php, I see the following in wordpress logs:

[16-Sep-2019 18:47:34 UTC] PHP Fatal error:  Uncaught Error: Call to 
undefined function mysql_connect() in C:\apps\httpd-2.4.41-win64- 
VS16\Apache24\htdocs\wordpress\wp-includes\wp-db.php:1643

I tried the solutions available online but I still see the error.

Solutions I tried so far:

Add the following to my wp-config.php:

define( 'WP_USE_EXT_MYSQL', true);

Added following to php.ini:

extension_dir = "ext"
extension=php_mysqli.dll

This is my phpinfo:

Server API  Apache 2.0 Handler
Virtual Directory Support   enabled
Configuration File (php.ini) Path   C:\windows
Loaded Configuration File   C:\apps\php-7.3.9\php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed    (none)
PHP API 20180731
PHP Extension   20180731
Zend Extension  320180731
Zend Extension Build    API320180731,TS,VC15
PHP Extension Build API20180731,TS,VC15
Debug Build no
Thread Safety   enabled
Thread API  Windows Threads
Zend Signal Handling    disabled
Zend Memory Manager enabled
Zend Multibyte Support  disabled
IPv6 Support    enabled
DTrace Support  disabled
Registered PHP Streams  php, file, glob, data, http, ftp, zip, compress.zlib, phar
Registered Stream Socket Transports tcp, udp
Registered Stream Filters   convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*
Share Improve this question edited Sep 16, 2019 at 19:29 Pat J 12.3k2 gold badges28 silver badges36 bronze badges asked Sep 16, 2019 at 19:07 sotnsotn 1311 silver badge5 bronze badges 2
  • did you restart apache after modifying php.ini? The error indicates it's unable to use mysqli .. so it's trying to fallback on the old mysql_* functions which were deprecated before PHP7 (and rightly so, as those functions were prone to injection). – flauntster Commented Sep 17, 2019 at 2:41
  • I just ran into this myself. WP_USE_EXT_MYSQL should be set to false if you want it to use mysqli, not true. Set it to false if you want it to use mysqli. – Manachi Commented Apr 9, 2021 at 11:21
Add a comment  | 

1 Answer 1

Reset to default 0

As Pat J says, you shouldn't have define( 'WP_USE_EXT_MYSQL', true); unless you need the old mysql functions, which you do not if you're using PHP 7x and WordPress 5x. You do need to restart Apache after modifying php.ini. What do you have in your mysqli section of your phpinfo? Make sure extension_dir is set in php.ini, too. You may need to enable php.ini error logging to see if your mysqli extension is loading by setting display_startup_errors = On set error_log to [filename] or syslog.

本文标签: mysqlUncaught Error Call to undefined function mysqlconnect()Wordpress installation