admin管理员组文章数量:1418104
I host my own WP site on a Debian/Raspbian buster server.
I upgraded PHP 7.1 to 7.3 and the site broke.
I can't understand why it broke because mysql_connect() is deprecated for 7.x (though wp-db.php seems to use it extensively - while WP nags you to upgrade to 7.3). So I looked to enabling the various modules in the fresh 7.3 install php.ini. MySQLi
was commented out, so I enabled that (and a few others) but still get the same error.
Call to undefined function mysql_connect()... wp-db.php on line 1643
which is...
if ( WP_DEBUG ) {
1643 $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
Php info references MySQLi several times so I'm assuming it's running. The same for mysqlnd
.
I know this question gets asked a lot. But I have tried just about everything out there.
How can I get my site working again on 7.3?
Edit: I tried disabling plugins by renaming the dir and got the same result. I suspect the issue is my 7.3 PHP config, since 7.0 worked fie.
I host my own WP site on a Debian/Raspbian buster server.
I upgraded PHP 7.1 to 7.3 and the site broke.
I can't understand why it broke because mysql_connect() is deprecated for 7.x (though wp-db.php seems to use it extensively - while WP nags you to upgrade to 7.3). So I looked to enabling the various modules in the fresh 7.3 install php.ini. MySQLi
was commented out, so I enabled that (and a few others) but still get the same error.
Call to undefined function mysql_connect()... wp-db.php on line 1643
which is...
if ( WP_DEBUG ) {
1643 $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
Php info references MySQLi several times so I'm assuming it's running. The same for mysqlnd
.
I know this question gets asked a lot. But I have tried just about everything out there.
How can I get my site working again on 7.3?
Edit: I tried disabling plugins by renaming the dir and got the same result. I suspect the issue is my 7.3 PHP config, since 7.0 worked fie.
Share Improve this question edited Sep 3, 2019 at 11:11 square_eyes asked Sep 3, 2019 at 10:54 square_eyessquare_eyes 1152 silver badges10 bronze badges 1- 1 That error occurred in WP Core, have you made changes to WP itself? Is this a super old version? Current WP has different code on those lines github/WordPress/WordPress/blob/master/wp-includes/… – Tom J Nowell ♦ Commented Sep 3, 2019 at 11:31
2 Answers
Reset to default 2I mean your php.ini is changed, check for the entry extension=php_mysqll.dll
.
(If you has no knowledge where is your used php.ini - see https://stackoverflow/questions/8684609/dude-wheres-my-php-ini)
Is this entry active, has no ;
before the string. After change of the php.ini you need a restart of mysql, like sudo /etc/init.d/mysql restart
.
Also a note, check that mysql is installed for the newer php version, maybe via console or the phpinfo()
.
sudo apt-get install mysql-server mysql-common php7.3 php7.3-mysql
Your problem is either:
- very old WordPress
- custom modifications to WP Core
Update to a newer version of WordPress to resolve the problem
For example, if we look at the current WP source code, it doesn't use mysql_connect
and hasn't for years:
https://github/WordPress/WordPress/blob/master/wp-includes/wp-db.php#L1638
if ( WP_DEBUG ) {
mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
} else {
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
@mysqli_real_connect( $this->dbh, $host, $this->dbuser, $this->dbpassword, null, $port, $socket, $client_flags );
}
It won't be enough to just change mysql_connect
to mysqli_real_connect
though, as there are other changes. So update to the latest WordPress
本文标签: apacheCall to undefined function mysqlconnect() After upgrading PHP 71 to 73
版权声明:本文标题:apache - Call to undefined function mysql_connect() After upgrading PHP 7.1 to 7.3 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745190443a2646885.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论