#52001 closed defect (bug) (duplicate)
PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect()
Reported by: | ipajen | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | blocker | Version: | 5.6 |
Component: | Database | Keywords: | |
Focuses: | Cc: |
Description
WP 5.6 and after upgrading to PHP 8 from PHP 7.4 following error occurs:
(removed paths)
[STDERR] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in wp-db.php:1688 Stack trace: #0 wp-db.php(632): wpdb->db_connect() #1 load.php(527): wpdb->__construct() #2 wp-settings.php(124): require_wp_db() #3 wp-config.php(88): require_once('/home/khaotipth...') wp-load.php(37): require_once('/home/khaotipth...') #5 wp-blog-header.php(13): require_once('/home/khaotipth...') index.php(17): require('/home/khaotipth...') #7 {main} thrown in wp-db.php on line 1688
Disabled all plugins and changed to Twenty Twenty-One (twentytwentyone).
(If I disable mysqli in 7.4 the same error occurs.)
My first bug report to WP so be kind ;)
Change History (4)
#1
@
4 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
- Summary changed from WP 5.6 and PHP8 > PHP Fatal error: Uncaught Error: Call to undefined function to PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect()
#3
@
4 years ago
@hellofromTonya @desrosj
Thank you, I checked the wp-config.php and I did not have the WP_USE_EXT_MYSQL and mysqli is enabled in the extension.
I was using PHP 7.4 (where the mysql_connect() was removed already and everything worked fine) until before upgrading to PHP 8. No changes has been made except upgrading to PHP 8. So the question is why does it want to use mysql_connect instead of correct mysqli. Got 3 word press installltions on same hosting and all has the same problem, one of is very newly installed.
Hello @ipajen,
Welcome to Trac!
I'm sorry you are experiencing issues with WordPress 5.6.
The
mysql_connect()
function was deprecated in PHP 5.5 and removed in 7.0.0 see the PHP documentation.Since 3.9, WordPress uses
mysqli
on PHP 5.5 or later instead of the deprecated mysql extension. See this post for more context: MySQL in WordPress 3.9.In #51988 related ticket, Sergey makes the following suggestion:
I'm closing this ticket as this issue is not due to WordPress core software.