Import Wordpress site from Cpanel

Overview

Wordpress is the most used tool in the world for creating websites and blogs.

Cpanel is the most used hosting control panel currently.

In this tutorial you will learn how to import a website made with Wordpress and hosted in a Cpanel server.

Quick Start

Login

Open the admin in your browser http://admin.daspanel.site

Daspanel login

The admin user and your password are the ones you choose when creating your project as instructed here.

Create new site

Go to the Sites module

Daspanel sites

  1. Add new site clicking the "+" icone in the upper right of the Sites panel to see the page with the options for the new site:

Daspanel wordpress new

  1. Description: Write an description for your new site
  2. Type: Choose 'Wordpress' as Type
  3. Engine: And 'PHP 5.6' as Engine
  4. Click on the button 'CREATE SITE'

PHP version

The site that will be imported is hosted in a Cpanel account that uses PHP 5.6. Thus, we chose the equivalent Daspanel PHP engine.

After the site has been created, a screen will be displayed to upload any remote content that is in a ZIP file. For this howto we will NOT use this feature.

Cancel upload

  1. Click the left arrow Alt at the top of the screen to return to the sites page.

Import site content files

The firebase-tools is a program that must be run through a console. To do this open the console of the site that was created:

Daspanel site

  1. Click the second bullet to display the toolbox management area of the chosen site.

The site card will be changed to the toolbox management area:

Daspanel site toolbox console

  1. Click on the console icon to access it.

If this is the first time you access the console in the current session of your browser, a screen like this will appear to log in:

Daspanel console login

  1. User Name: Is the console user.
  2. Password: Is the console user passord.
  3. Click the login in button.

Login credentials

You can easily obtain login credentials in the *** Console *** section of the Daspanel System->Services Users module using the link below:

admin.daspanel.site/system/services/users

After your browser has an authentication token with console access permission, the web page of the console will be displayed:

Daspanel console

Cpanel account info
FTP Server ftp.cpanelserver.com
Cpanel Account cpanelaccount
Cpanel Account Password mysupersecrectpassword
Site Directory public_html

Now run this command on the console:

lftp -u cpanelaccount,mysupersecrectpassword -e 'mirror -v --ignore-time --parallel=4 public_html public_html; bye' ftp.cpanelserver.com

When the command finish you see an screen like this:

Daspanel console lftp finished

Set root dir of the site

When the site was created its content is initially served from the directory of its default version.

That is, when you access, for example, https://wonderful-bartik.sites.daspanel.site/ the content displayed is being fetched from a directory like this content/cjb71wzv1000365o420pyc5np/v/cjb71wzxb000465o4u7cquskg.

However, when importing the Cpanel site the content of it is in the sub directory content/cjb71wzv1000365o420pyc5np/v/cjb71wzxb000465o4u7cquskg/public_html.

Before viewing the site configure the root dir of it going to manage the available versions of a site go to the Sites module

Daspanel site versions

  1. Click the third bullet to display the version management area of the chosen site.

The site card will be changed to the version management area:

Daspanel site versions tab

  1. Click the MANAGE buttom to go the management page.

On the next page you will see a list of all the existing versions for the site:

Daspanel version

  1. Click the Edit button for the choosen site.

Daspanel version

  1. Set the directory relative to the top level directory where the site version exists. In this case it is /public_html.
  2. Click UPDATE VERSION to save changes.

Update Wordpress configuration

Before proceeding, you need to make a small adjustment to the wp-config.php file: change the MySql hostname.

Access the site file manager, enter into the public_html dir, click on the wp-config.php file icon and you will see its contents:

wp-config.php content

Almost always the value set for the DB_HOST variable will be equal to localhost. In Daspanel the MySql server is in a separate container and so we need to change the value to the correct hostname.

  1. Click the Edit button.

Being in edit mode:

wp-config.php content edit

  1. Change he DB_HOST variable to the value daspanel-mysql:
  2. Click the Save file button.

Before proceeding take note of the database access information, they will be needed in the next step:

wp-config.php db info

Create Wordpress database in Daspanel

Before import the Wordpress database you need a MySQL database in Daspanel. Click the link below to find out how to use the Daspanel database management service:

Database manager usage

Remember to create your database and its user with the information that is in wp-config.php as in the previous section of this tutorial.

Import Wordpress database

In Cpanel the tool that has to be used to export the database is phpmyadmin. It is beyond the scope of this tutorial to explain how to use it, but on wordpress.org this page explains how to export the database of a wordpress website.

After the exported database file is saved to your local computer, use the Daspanel database management service to create an new local database and import the Wordpress database exported from the Cpanel server.

In the Daspanel database management page:

adminer import wp database

  1. Make sure you have select the correct database.
  2. Click Import buttom.

In the next page:

adminer import wp database

  1. Select the database exported sql file.
  2. Click Execute to start the import.

When the import finishes successfully a page similar to this will be displayed:

adminer import wp database

Changing the site URL

When you import a Wordpress site to be used with another domain name, it usually stops working, it has problems with redirection, broken images, etc.

This is because Wordpress saves its content information to the database with the domain for which it was originally created.

The internet is full of information about this and also with several ways to solve the problem. In this tutorial we will adopt one suggested in wordpress.org in the link below:

Changing_The_Site_URL

Go back to the site console and run the following commands:

cd public_html
wp option get siteurl
The output of the wp option get siteurl is the current set value set for this Wordpress option.

wp command

Daspanel comes with wp-cli installed on the engines that support Wordpress. It can be executed by running the wp command. Learn more about wp-cli at this link:

wp-cli.org

Go to the Sites module and copy the URL of the new wordpress site created in Daspanel:

sites url info

The URL will look something like https://boring-pare.sites.daspanel.site

With the original siteurl value and the site URL in Daspanel in hand run the following commands:

wp option update siteurl 'https://boring-pare.sites.daspanel.site'
wp option update home 'https://boring-pare.sites.daspanel.site'
wp search-replace 'http://oldsiteurl.com' 'https://boring-pare.sites.daspanel.site' --skip-columns=guid --report-changed-only
wp search-replace 'htts://oldsiteurl.com' 'https://boring-pare.sites.daspanel.site' --skip-columns=guid --report-changed-only

View the new site

Go to the Sites module. You will see a page like this:

Daspanel wordpress preview

  1. Click the "PREVIEW" button and a new window will open in your browser displaying the contents of the active version of the site.

Next Steps

Docs Home