If you’ve read and followed a tutorial for migrating a WordPress portal but your site isn’t working after migration, go through the following paragraphs, where we have covered possible reasons why your site isn’t working and its solutions.
The database entries in the wp-config file are incorrect
One of the first things that a WordPress website builder does when an uncached page is requested is that it reads the wp-config PHP file data. Although every line of code in this file is important, these four things are critical in our perspective:
DB_NAME
: This variable is assigned the database name. As WP runs SQL queries to get data from the database tables, you should specify
DB_USER
: As the name suggests, you assign the MySQL user to the variable DB_USER. When you install WP manually or a script does so, it creates a DB user before doing anything else.
DB_PASSWORD
: Without a password, the WP website builder won’t be able to access the database.
DB_HOST
: To be honest, no one changes the value of the variable DB_HOST. The default value is localhost.
If any of the above entries are incorrect or empty, your site won’t work. Thus, you must first verify the entries of the wp-config file before doing anything else if your WP site isn’t working.
Incorrect nameservers
When you set up a website on a shared or VPS hosting company, the company shares nameservers with you. The Nameservers play an important role in connecting visitors to the website. If they are shut down or are not functioning, your web portal won’t be reachable. To fix the problem of the WordPress portal not working after migration, you should check the nameservers details by logging into your registrar’s account.
PHP, MySQL, or Nginx service isn’t working
If the PHP, MariaDB, or Nginx service isn’t functioning, websites on your server won’t work as Nginx is responsible for sending the requests to the PHP, PHP is responsible for interpreting the PHP code, and Mariadb stores the site data. If your portal is powered by the LEMP stack, you must start these three services if your site isn’t working because any of these three services aren’t running. What if you start the services and your server is shut down by the host because of maintenance or for patching? To ensure that you don’t have to start the services manually when the server is restarted or is down and starts again, you should enable the services using the following commands.
sudo systemctl enable nginx.service
sudo systemctl enable php.service
sudo systemctl enable mysqld.service
or mariadb.service
To check if the nginx, MySQL, or PHP service is working or running or not, you can run these commands:
sudo systemctl status nginx.service
sudo systemctl status mariadb.service
sudo systemctl status php-fpm.service
Server is down
If the server itself is down, how can the services or sites hosted on it be accessible? To check whether the server is reachable or not, you can use the ping command. The command accepts an IP address or a domain as a parameter. After running the command ping domain_name or ping ip_address, wait for a few seconds, and then close the ping process by clicking the ctrl and z buttons together. When the process is closed, the console or terminal will show these details:
- Packets transmitted and lost.
- Packets received.