I upgraded my WordPress server to PHP 8.2 and MariaDB 10.6 and broke it; I get \"cannot connect to database. I can replicate this issue on a brand new, vanilla server. Apache 2.4, PHP8.2, Maria DB 10.6, FreeBSD 13.2…as soon as I enter DB credentials into WordPress setup, I get “cannot connect to server”<\/p>\n
I haven’t had the time yet to start working my way backwards to see which version works, but my current working setup is Apache 2.4, PHP7.4 and MariaDB 10.3<\/p>\n
Has anyone else come across an issue like this?<\/p>","upvoteCount":3,"answerCount":8,"datePublished":"2023-10-31T01:13:46.000Z","author":{"@type":"Person","name":"Carl-Holzhauer","url":"https://community.spiceworks.com/u/Carl-Holzhauer"},"acceptedAnswer":{"@type":"Answer","text":"
I figured it out…my wp-config.php file had “localhost” for the database server, once I changed that to 127.0.0.1, everything worked fine. I confirmed it on the brand new servers I stood up as well as the “broken” one I had laying around still<\/p>","upvoteCount":0,"datePublished":"2023-11-01T17:41:11.000Z","url":"https://community.spiceworks.com/t/wordpress-with-php8-2-and-mariadb-10-6/961685/8","author":{"@type":"Person","name":"Carl-Holzhauer","url":"https://community.spiceworks.com/u/Carl-Holzhauer"}},"suggestedAnswer":[{"@type":"Answer","text":"
I upgraded my WordPress server to PHP 8.2 and MariaDB 10.6 and broke it; I get \"cannot connect to database. I can replicate this issue on a brand new, vanilla server. Apache 2.4, PHP8.2, Maria DB 10.6, FreeBSD 13.2…as soon as I enter DB credentials into WordPress setup, I get “cannot connect to server”<\/p>\n
I haven’t had the time yet to start working my way backwards to see which version works, but my current working setup is Apache 2.4, PHP7.4 and MariaDB 10.3<\/p>\n
Has anyone else come across an issue like this?<\/p>","upvoteCount":3,"datePublished":"2023-10-31T01:13:46.000Z","url":"https://community.spiceworks.com/t/wordpress-with-php8-2-and-mariadb-10-6/961685/1","author":{"@type":"Person","name":"Carl-Holzhauer","url":"https://community.spiceworks.com/u/Carl-Holzhauer"}},{"@type":"Answer","text":"
Did you by chance disable the user from connecting locally?<\/p>","upvoteCount":0,"datePublished":"2023-10-31T02:18:24.000Z","url":"https://community.spiceworks.com/t/wordpress-with-php8-2-and-mariadb-10-6/961685/2","author":{"@type":"Person","name":"jimender2","url":"https://community.spiceworks.com/u/jimender2"}},{"@type":"Answer","text":"
The database user? I don’t think thats it, I can’t even connect as root from the site<\/p>\n
Either user works fine from the command line<\/p>","upvoteCount":0,"datePublished":"2023-10-31T10:11:52.000Z","url":"https://community.spiceworks.com/t/wordpress-with-php8-2-and-mariadb-10-6/961685/3","author":{"@type":"Person","name":"Carl-Holzhauer","url":"https://community.spiceworks.com/u/Carl-Holzhauer"}},{"@type":"Answer","text":"
Whole bunch of possibilities here.<\/p>\n
I don’t work with your distribution or version of *nix, so am not certain how modern or ancient it is.<\/p>\n
Has your PHP 8.2 replaced the PHP 7.4 in the primary location on the server or is it installed in another location as an /opt?<\/p>\n<\/li>\n
Is your apache set up and running with php-fpm?<\/p>\n<\/li>\n<\/ul>\n
You didn’t mention what version of Wordpress you are working with. I’m assuming it is the current 6.3.2 or thereabouts.<\/p>\n
I’ve worked in the CentOS 5/6/7 releases and now am doing it with Rocky Linux.<\/p>\n
If you’ve got php-fpm in place and php 8.2 is from a place like the Remi Repository, then both of these get installed in their own alternate place in the /opt tree.<\/p>\n
The other convention is that the service name for php-fpm gets extended with the version - php82-php-fpm.<\/p>\n
Same idea for apache, httpd is now httpd24-httpd.<\/p>\n
The other thing about apache and php-fpm is that PHP details you used to have in Apache phpadmin statements is now in the php-fpm configuration file. I found I had to provide tell each apache site that it was a given PHP version and that had to also be matched with php-fpm.<\/p>","upvoteCount":0,"datePublished":"2023-10-31T14:44:42.000Z","url":"https://community.spiceworks.com/t/wordpress-with-php8-2-and-mariadb-10-6/961685/4","author":{"@type":"Person","name":"jadrien","url":"https://community.spiceworks.com/u/jadrien"}},{"@type":"Answer","text":"
IIRC 8.1 didn’t work either. I’ll stand up a new VM tonight and experiment with that version. The test I did to replicate my issue was all brand new software, no upgrades.<\/p>\n
FreeBSD 13 is the latest; it doesn’t use /opt, but I understand what you’re getting at, I will look into it.<\/p>\n
No PHP-FPM. Tonight I will post all of the packages I have installed<\/p>","upvoteCount":0,"datePublished":"2023-10-31T14:53:04.000Z","url":"https://community.spiceworks.com/t/wordpress-with-php8-2-and-mariadb-10-6/961685/5","author":{"@type":"Person","name":"Carl-Holzhauer","url":"https://community.spiceworks.com/u/Carl-Holzhauer"}},{"@type":"Answer","text":"
Since php is crossing a major version boundary - 8.0 - that is the point in most software where major changes take place, so you likely have some issues due to that. Check the Upgrading and migration pages here<\/a> to track down context for what isn’t working for you.<\/p>\n Do note also that if you’ve been working on apache 2.2 code and are now on 2.4 involves a bunch of module changes that frequently used syntax in .htaccess and any apache .conf have to be changed. service httpd configtest is your friend for that.<\/p>","upvoteCount":0,"datePublished":"2023-11-01T12:00:39.000Z","url":"https://community.spiceworks.com/t/wordpress-with-php8-2-and-mariadb-10-6/961685/6","author":{"@type":"Person","name":"jadrien","url":"https://community.spiceworks.com/u/jadrien"}},{"@type":"Answer","text":" I’ll check that out, thanks.<\/p>\n I’ve been on Apache2.4 for a little while, so no issues there. Although, maybe there’s something different I need to put in its configs with PHP8<\/p>","upvoteCount":0,"datePublished":"2023-11-01T12:18:44.000Z","url":"https://community.spiceworks.com/t/wordpress-with-php8-2-and-mariadb-10-6/961685/7","author":{"@type":"Person","name":"Carl-Holzhauer","url":"https://community.spiceworks.com/u/Carl-Holzhauer"}}]}}