Wordpress 5.6 does not support PHP 8?
Get the solution ↓↓↓Scenario
I had installed php8 and wordpress 5.6 locally over my computer.
Problem
When I run the wordpress, I get Fatal Error.
Question
Anyone of you facing the same problem and how did you solve it? Thanks
Answer
Solution:
Your PHP 8 installation does not have amysqli
extension installed.
See possible dupe: Wordpress Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /wp-includes/wp-db.php:1570
I kind of wish WordPress would tell you explicitly that it's missing a usable database extension. The major indicator is the error message itself where WordPress tries to callmysql_connect
which was removed ages ago.
WordPress 5.6 core appears to run correctly on PHP 8. Though, the same might not be true of plugins (yet), so you'll want to test them individually.
[Edit] WordPress's database abstraction is written to use either themysql
ormysqli
extensions, but themysql
extension was removed in PHP 7.0. The abstraction library does not support PDO, so even if you have the PDO MySQL driver, WordPress will not use it.
Edit: And to demonstrate a reproduction of the error, I took the same install, but rebuilt my Docker image without themysqli
extension:
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: warning: a non-numeric value encountered in
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.