4: Reproduce the old WordPress site in the new KUSANAGI environment

As an admin user on KUSANAGI console, extract the files you sent.

cd /home/kusanagi/
tar zxvfp www.tar.gz

Extract the files in the KUSANAGI environment

Next, we will import the database, arrange the extracted files, edit wp-config.php, update WordPress and install KUSANAGI plugins, set ownership and permissions, and log in to the dashboard.

5: Import the database

KUSANAGI is optimized for the InnoDB storage engine. If your pre-migration environment uses the MyISAM storage engine, you will need to change the table schema for the dump file. Follow the code below to change the “ENGINE=MyISAM” part of example.sql to “ENGINE=InnoDB”.

cd /home/kusanagi/www
sed 's/ENGINE=MyISAM/ENGINE=InnoDB/g' example.sql > example.InnoDB.sql

Change the dump file’s table schema (If your storage engine was MyISAM).

Import the database.

mysql -u example -p -h localhost example < example.InnoDB.sql

Make sure that the database table is correct.

mysql -u example -p -h localhost example -e 'show table status'

Check whether the database was properly imported.

If the Engine field is set to “InnoDB”, then it was imported correctly.

6: Place the extracted files

First, we will temporarily move the default document root that was set during KUSANAGI provisioning, so that we can use it later.

cd /home/kusanagi/example.com
mv DocumentRoot DocumentRoot.def

Temporarily move the document root.

Now we will arrange the files we extracted. We will set the pre-migration html document root directory to the same name and location as the DocumentRoot directory created during KUSANAGI provisioning.

mv /home/kusanagi/www/html /home/kusanagi/example.com/DocumentRoot

Place the pre-migration document root in the DocumentRoot directory of the KUSANAGI environment.

Move wp-config.php to one level above the document root.

cd /home/kusanagi/example.com/DocumentRoot
mv wp-config.php ../

Move wp-config.php one level up.

7: Fix the contents of wp-config.php

Now we will edit wp-config.php. First, we will input some of database data that was set during KUSANAGI provisioning.

/** MySQL database user name */
define('DB_USER', 'exampleuser');

/** MySQL database password */
define('DB_PASSWORD', 'Password123!');

Editing wp-config.php (1)

If WP_CACHE has not been defined, add the following code above the line near the end of wp-config.php that says /* That’s all, stop editing! Happy blogging! */

define('WP_CACHE', false);

Add this near the end of wp-config.php

If you were using the WP SiteManager plugin in your pre-migration environment, some of the features will overlap with KUSANAGI’s plugins. In order to use KUSANAGI’s page caching and device switching features, paste the code below in the vicinity of the WP_CACHE constant from the previous step.

define('WPSM_DISABLE_CACHE', true);
define('WPSM_DISABLE_DEVICE', true);

Inserting constants to enable use of KUSANAGI plugins.

We have now done the basic setup for WordPress. Access the WordPress site in its new KUSANAGI environment from a browser and check that it is working properly.

If it isn’t working, set WP-DEBUG in wp-config.php to “true”, and check the error messages or server log (below /home/kusanagi/example.com/log or below /var/log). Sometimes pre-migration plugins will not work with HHVM (HipHop Virtual Machine) or PHP7. To check if it is a programming language-specific problem, use the following commands to switch KUSANAGI between PHP, HHVM and PHP 5.6:

kusanagi php7

The command to switch the PHP environment to PHP 7

kusanagi hhvm

The command to switch to HHVM

kusanagi php-fpm

The command to switch to PHP 5.6

8: Update WordPress and install KUSANAGI plugins

If everything is functioning correctly, we will save the contents of the DocumentRoot.def directory that we set aside in (6) over the DocumentRoot directory. The DocumentRoot.def directory includes the newest WordPress core, KUSANAGI plugins, and control files such as .htaccess. By saving it to the DocumentRoot directory, WordPress gets updated and KUSANAGI’s plugins get installed.

cd /home/kusanagi/example.com/DocumentRoot.def
/bin/cp -rp * ../DocumentRoot/

Save the contents of the DocumentRoot.def directory that we set aside to the DocumentRoot directory.

Check whether or not the WordPress site is working by visiting with from the browser one more time.