Manually Restoring A cPanel Hosting Service To Another Server is Not Too Difficult If You Have The Context
I'm by no means an expert at this but with my recent hosting provider unable to restore my Drupal site under their cPanel I was forced to my own crash course on how to restore it to my new hosting service at DigitalOcean. There are always going to be small details that trip you up but the context I can give here may help many others in this situation who want to give it a try. If you are just restoring straight back into your previous hosting domain name and structure, this process is not required, and a straight restore in Softaclous will normally do the trick. But if you are changing providers or host URL's then you'll want to consider this.
There are generally these layers of service you'll encounter:
1. The server OS with Apache web server, MySql and PHP running or the so-called LAMP stack
2. Softacluous running under a cPanel or Webuzo for shared hosting services. I'm using a free-standing Webuzo install for a single user to manage the Softaclous scripts.
3. MySQL service with a database per service.
4. Folders per service that have their configuration files, PHP script files, and data files.
If you have a Softaculous backup and you've downloaded that backup file, it can be copied to the new root web folder, and be expanded there. Usually, it will create the sub-folder structure there with all the files and folder, and also include a .sql file in the root of that folder. That sql file is the database. You also want to make sure that all the files and folders are owned by the web server user, or the Softalulous user (in other words, not root user).
You need to now file the following info from a config file in those folders: database name, database user name, database user password. You could create new ones but I've found with Piwigo, for example, it hard codes some info in its database. So for Drupal the config file is named "settings.php" and found in "public_html/drupal/sites/default/" whilst for NextCloud the config file is named "config.php" and found in "public_html/nextcloud/config/". The details can differ a bit depending on what sub-folder you have created as the root web directory, but hopefully, you get the idea.
Armed with that info you can go to your new cPanel or Webuzo and open phpMyAdmin and you want to create an empty database with the same database name you found in the config file. Then create a new user account also in phpMyAdmin with the user name and password you got from the config file, and lastly give that user full permissions for that database.
If your database is not bigger than 50MB or so you could have maybe imported that SQL file from the root folder directly into phpMyAdmin, but most of mine were bigger and I had to import them from the command line. To import from CLI log in via SSH as root user and change directory to the root folder where you unpacked all the files ie. same location where that SQL file is. Then run the command "sudo mysql -uID -pPassword newdatabase < olddatabase.sql" where ID is the database user name, Password is the DB user password, newdatabase was the name of the empty database you created, and olddatabase.sql is the database file that was lying in that root web folder and which you want to import.
If the database import gives errors it could be because your user is not linked to the new database or you did not grant it full permissions.
Make sure after this that the config file does match the new database, user and password before trying to start the app from a web browser. You should have a domain name already pointing to that web folder.
If you want to manage backups and updates within Softaculous there is an easy way to "import" this installation into Softaculous. Just go to Softacluous and navigate to the app's overview where you'd normally go to install it, but instead of clicking on Install, click on Import instead, and choose "From this Server" and fill in the details and click on the Import button.
I've glanced over quite a bit of finer detail as the aim here was to give a contextual overview of the process. Remember because you are working from a backup file you can keep fixing and retrying until you get it right so don't panic. It took me 2 or 3 days to get right as I had to retry many times. Point is it will come right with patience and some Google searching.
source https://drupal.gadgeteerza.co.za/node/3238
Comments