Whoops - First Step in Bug Hunting
The first thing we want to do is to put WordPress into Debug mode. To do this edit the wpconfig.php file and change WP_DEBUG to TRUE:

Refresh your browser and you will see more information on whatever error you are seeing.

IBM i WordPress - Error Examples
(1) Internal Server Error
This normally happens when your HTTP Server or PHP Server is not active, or the port is blocked - either way my browser cannot find the webserver:

(2) Error establishing a database connection
Good News - PHP Server Connection OK
Bad News - Cannot access database
So, this means WordPress tried to connect to your MariaDB/MySQL server, but the connection was blocked before it even reached the database.
This is not a wrong password error. This is not a missing database error.
It means the PHP process does not have permission to open a network/socket connection to MySQL.
This is a huge step in the right direction - it means my IBM-i PHP Server is working, the port is correct and I am talking to WordPress. The bad news is that WordPress is not happy with something about the database connection and how we have configured it!

Hmmmmmmmmmmm.
So, my first thought was to check that my user MYSQL can access the data base correctly. I launched a terminal in VS-Code, happily connected to the database and attempted to read it. Then, darkly happy, I see an access/authority problem:
Solution Attempt 1 -- Create a new database while signed in as MYSQL
Start a new terminal and login with the user account what we are using in our /www/your-php-server/htdocs/wp-config.php
Once logged in we will create a new database for our WordPress install to live in. Let's called it "WordPress2026" :
But this did NOT solve my problem! 🙁
Solution Attempt 2 -- Check that LOCALHOST is accessible
Test from the command line (same user as Apache/PHP)
If you can, run:
If that fails with permission denied, it’s definitely a socket or authority issue.
If that works then let's try switching WordPress to TCP instead of socket
In wp-config.php, change:
to:
This forces WordPress to use TCP instead of the socket, which is often the simplest fix on IBM i.

