Phase 1: Files, Imports, and Table Prefixes
The migration process began with a manual approach: extracting a proprietary .wpress archive to isolate the core WordPress files and the SQL database dump. In modern WordPress architecture, the wp-content directory houses the actual unique site data. The first step was uploading the extracted plugins, themes, uploads, and languages directories to the new Hostinger environment. Extraneous developer files like package.json, redundant security lock files, and the default index.php were intentionally bypassed to maintain a clean file structure.
With the file foundation established, the focus shifted to restoring the MySQL database using phpMyAdmin. This immediately presented the first technical hurdle: the #1046 - No database selected error. This occurs when a raw SQL dump does not contain a USE database_name; directive. The database server receives the data but lacks the routing instruction on where to store it. The solution was strictly procedural: explicitly clicking the target Hostinger database name in the phpMyAdmin navigation tree before initiating the import.
Once imported, a critical structural conflict emerged. The Hostinger auto-installer had provisioned default tables using a wpwl_ prefix, while the imported tables carried a SERVMASK_PREFIX_ placeholder generated by the All-in-One WP Migration tool. To ensure future compatibility, the database required standardization to the default wp_ prefix. During the cleanup of the dummy wpwl_ tables, a #1090 - You can't delete all columns with ALTER TABLE error was triggered. This is a common phpMyAdmin interface trap; attempting to drop a table while viewing its internal columns causes the system to attempt a column deletion rather than a table drop. Navigating back to the root database structure view resolved this, allowing the safe removal of the dummy tables. Finally, a batch SQL RENAME query was executed to convert all SERVMASK_PREFIX_ tables to wp_. The resulting "empty result set" notification confirmed that the structural schema change was executed flawlessly without returning unnecessary data rows.
Phase 2: Configuration and The White Screen of Death
With the database schema corrected, the WordPress configuration file (wp-config.php) required manual alignment. The site initially returned an "Error establishing a database connection." This critical failure indicated that the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST constants were still pointing to the legacy UK2 server environment. Updating these variables to match the new Hostinger credentials restored the connection, but immediately resulted in the infamous White Screen of Death (WSOD).
The WSOD is a deliberate security mechanism in PHP and WordPress designed to suppress fatal error outputs on production environments, rendering a blank page instead of exposing sensitive server paths. Standard diagnostics commenced: renaming the .htaccess file to rule out legacy Apache routing conflicts, and testing PHP version downgrades to rule out deprecation errors with older plugins. When neither variable resolved the issue, the investigation targeted the wp-content directory.
By systematically renaming the plugins and themes folders to force WordPress to disable them, the root cause was isolated. Disabling the active theme triggered a visible PHP notice, proving that the silent fatal error was originating from the theme layer. Furthermore, the wp-config.php file contained residual execution code from the Really Simple Security plugin, which was attempting to enforce strict session cookies on a mismatched domain state. Stripping this legacy code from the configuration file was a necessary sanitation step.
Phase 3: Bypassing the Missing Theme
Further inspection of the server directory revealed the precise cause of the WSOD: the custom theme folder was entirely absent from the extracted backup. The themes directory contained only default WordPress fallbacks (like twentytwentyfour and twentytwentyone). However, the freshly imported database was strictly instructed to load the missing custom theme. When the core software attempted to call functions from a directory that did not exist, the PHP execution crashed entirely.
Because the site was inaccessible via the standard /wp-admin dashboard, the active theme had to be overridden directly at the database level. WordPress stores the active theme configuration inside the wp_options table. To bypass the crash, a targeted SQL update was deployed:
UPDATE wp_options SET option_value = 'twentytwentyfour' WHERE option_name = 'template';UPDATE wp_options SET option_value = 'twentytwentyfour' WHERE option_name = 'stylesheet';
By forcing the template and stylesheet variables to explicitly reference a default theme that verifiably existed on the server, the fatal error loop was broken. The front-end rendering engine successfully loaded the fallback architecture, bringing the text and database content back online.
Phase 4: Restoring Admin Permissions and Routing
With the site rendering visually, the next objective was dashboard access. However, authenticating via /wp-admin resulted in a restrictive "Sorry, you are not allowed to access this page" error. This is a notorious post-migration authorization failure directly tied to the earlier table prefix modifications.
WordPress user permissions are managed via a complex array of capabilities stored in the wp_usermeta and wp_options tables. These meta keys are strictly bound to the database prefix. Because the database was migrated from an environment using a unique numerical prefix (and temporarily held a SERVMASK_PREFIX_ label), the user account's administrative capabilities were orphaned. The core software recognized the username and password but failed to locate the wp_capabilities key, effectively demoting the administrator to a baseline subscriber with zero dashboard access.
To rectify this without manually searching for the exact legacy string, a wildcard SQL query was utilized:
UPDATE wp_usermeta SET meta_key = 'wp_capabilities' WHERE meta_key LIKE '%capabilities';UPDATE wp_usermeta SET meta_key = 'wp_user_level' WHERE meta_key LIKE '%user_level';UPDATE wp_options SET option_name = 'wp_user_roles' WHERE option_name LIKE '%user_roles';
This operation dynamically located any legacy permission keys and forcefully realigned them to the standardized wp_ prefix. Dashboard access was immediately restored.
The final operational anomaly was a site-wide 404 error affecting all subpages, a direct consequence of the .htaccess file being renamed during the WSOD diagnostics. Apache relies on this file to map clean URLs (Permalinks) to the internal WordPress routing index. Navigating to the Permalinks settings page in the dashboard and executing a blind save forced the application to dynamically generate a pristine .htaccess file with correct Hostinger routing rules. The subpages resolved flawlessly, completing a rigorous, manual, end-to-end server migration.
No comments:
Post a Comment
If you leave question they will get answered! But no spam please I will delete it. :-(