[wp-trac] [WordPress Trac] #51988: Call to undefined function mysql_connect()
WordPress Trac
noreply at wordpress.org
Wed Dec 9 19:50:31 UTC 2020
#51988: Call to undefined function mysql_connect()
--------------------------+----------------------
Reporter: bgin | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Database | Version: 5.6
Severity: normal | Resolution: invalid
Keywords: | Focuses:
--------------------------+----------------------
Comment (by desrosj):
From @ipajen on #52001:
> 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.
As of the release of PHP 8, the `@` operator will no longer suppress
errors fatal errors.
Looking at [https://core.trac.wordpress.org/browser/tags/5.6/src/wp-
includes/wp-db.php#L1684 the code in WordPress], unless `WP_DEBUG` mode is
enabled, the `@` operator preceded the `mysql_connect()` call. In previous
versions of PHP, it's likely that this just failed silently, and just
happened to work on accident.
As noted above, if `mysqli_connect()` is present on the server running
WordPress, it will always be used unless `WP_USE_EXT_MYSQL` is defined as
`true`.
The only ways to encounter this issue would be a PHP install with `mysqli`
missing or improperly configured, or the `WP_USE_EXT_MYSQL` being set to
`true`. I would search in the `mu-plugins` directory, check your active
plugins/`wp-config.php` file, or reach out to your hosting provider for
more help. It's possible the hosting environment has incompatibilities
with PHP 8 at the system level.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51988#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list