Skip to content

Copy a site by hand

This page is one of the ways to move a site to Netkeel. Use it for Custom PHP, Laravel, Joomla and Drupal sites, which have no import yet. It also works for WordPress, but the WordPress import does the database settings and the address change for you.

First do the steps under Before you move, so the server and the application exist.

SFTP is a way to copy files to a server. On Netkeel it uses SSH keys, not passwords.

  1. Create an SSH key if you don’t have one.
  2. Add it under the application’s SSH / SFTP.
  3. Connect with FileZilla, Cyberduck or WinSCP. See SFTP and SSH access.

Download the site’s files from the old host, then upload them into the application’s htdocs folder:

Type What to upload
Custom PHP The files that were in the old web root. index.php is served first.
Laravel The whole project. Its public folder is served.
Joomla The files that were in the old web root.
Drupal The whole Composer project, with web as the folder that is served. A Drupal site without that layout has to be converted to it first.

The old site’s configuration points to the old host’s database. Netkeel’s application already has its own database, and its login is on the card at the top of Database › Databases. Make the uploaded site use that login. Open your type:

Custom PHP

Replace the old database name, user, password and host in your configuration with the values from Database › Databases, or read them with getenv(). See Connect to the database.

Laravel

In the project’s .env, set:

  • DB_CONNECTION=mysql
  • DB_HOST=localhost
  • DB_SOCKET=/run/mysqld/mysqld.sock
  • DB_DATABASE, DB_USERNAME and DB_PASSWORD from Database › Databases

Keep the old APP_KEY: data encrypted with it can’t be read with a new one.

Joomla
  1. Before you upload, download Netkeel’s configuration.php from htdocs.
  2. After you upload the old site, copy the $host, $user, $password, $db, $tmp_path and $log_path lines from Netkeel’s file into the uploaded configuration.php.
  3. Keep the old $dbprefix: it must match the tables in your database dump.
Drupal

Don’t upload over web/sites/default/settings.php or settings.netkeel.php. Netkeel’s settings.php ends with a line that includes settings.netkeel.php, which holds the database login.

If the old settings.php has settings of your own, copy them into Netkeel’s file after that line, but leave out the old $databases block.

WordPress

Don’t upload over wp-config.php. If the old one has constants of your own, copy them into Netkeel’s file, but keep its DB_NAME, DB_USER, DB_PASSWORD and DB_HOST. Set $table_prefix to the old one, so it matches the tables in your dump.

Export the old site’s database as a .sql file (in phpMyAdmin: Export, Quick, SQL). Then load it in one of three ways:

Way For Limit
Import on the Databases page The main database of MySQL (MariaDB) and MySQL 8 applications A .sql file up to 10 GB
Adminer Smaller dumps, .sql or .sql.gz The application’s Upload max filesize: 128 MB by default, up to 1 GB under Settings › PHP
SSH Any size None

Go to Database › Databases and click Import on the main database’s card. The import replaces the database’s whole contents, after a safety backup. See Import or export SQL files.

Import with Adminer
  1. Go to Database › Databases and click Open Adminer. Adminer opens in a new tab, already signed in to the application’s database.
  2. To delete the installed tables first, tick the box at the top of the table list to select them all, click Drop and confirm.
  3. Click Import, choose your .sql or .sql.gz file under File upload, and click Execute.

For a larger file, raise Upload max filesize and Post max size under Settings › PHP (up to 1 GB), or use SSH.

Import over SSH
  1. Upload the dump with SFTP, for example into the application’s home folder.

  2. Turn on SSH access under SSH / SFTP and connect with the ssh command the page shows.

  3. Run, with the database user and name from Database › Databases:

    Terminal window
    mysql -u DATABASE_USER -p DATABASE_NAME < ~/dump.sql

    Type the database password when asked. For a .sql.gz file, run gunzip < ~/dump.sql.gz | mysql -u DATABASE_USER -p DATABASE_NAME.

  4. Delete the dump file when the import is done.

The database still holds the old site’s address. Run a search and replace from your domain to the application’s preview address, so the site works there before you take it live.

Add the old host’s cron jobs under Settings › Cron jobs. See Scheduled tasks. Laravel’s scheduler, and Joomla’s and Drupal’s own scheduled tasks, already run for you.

Check the site on its preview address, then switch your domain.