Back up Everything
If importing from your live WHMCS installation, stop the cron job for WHMCS, put the installation into maintenance mode, and back up all files and the database.
Initial Staff Username
When installing Blesta, you should choose a username that does not exist in your WHMCS installation, or it will result in an error when trying to import your WHMCS staff users.
Database Collation
Often times WHMCS has mixed database collations and this can cause issues during import. All tables should be InnoDB, if you have any MyISAM tables those should be converted also. For this reason we recommend:
- Cloning your WHMCS database, and updating the collation for all tables to utf8mb4_unicode_ci.
- Make sure Blesta is also utf8mb4 by going to Tools > Utilities. Updating Blesta from utf8 to utf8mb4 can be accomplished by clicking the "Update to utf8mb4" button. If the Description says "Database already supports utf8mb4" then the collation has already been updated.
- Import from your cloned utf8mb4_unicode_ci InnoDB WHMCS database.
- If you have trouble updating the collation, make sure your sql_mode does not have STRICT_TRANS_TABLES, or NO_ZERO_DATE
You may use this bash script via SSH to convert a clone of your WHMCS database to utf8mb4_unicode_ci InnoDB. Replace the DB, USER, and PASS definitions at the top of the file before running the conversion via ./convert-whmcs-db.sh. DO NOT RUN IT ON YOUR LIVE WHMCS DB. RUN ON A COPY ONLY.
Ticket Numbers
Blesta uses an int(10) column for ticket codes. If you have any non-numeric characters in your ticket system in WHMCS, you can update them to match the internal ID to prevent any errors during import. Do this to a cloned copy of your WHMCS database, not your production copy.
UPDATE tbltickets SET tid = id;
If you prefer, you can create a copy of your WHMCS database and import from that instead of your live system.
Data which is imported
The following data is imported from WHMCS to Blesta:
Import Type | Description |
---|---|
Payment Accounts | Credit / Debit cards saved in WHMCS. |
Admin (Staff) | Staff who log into your WHMCS. |
Affiliates | |
Calendar | Calendar events. |
Domains | Domain Names |
Emails | Emails sent to clients. |
Invoices | Invoices generated to your clients. |
Support Departments | Support departments made on WHMCS. |
Taxes | |
Clients (Active / Inactive) | Clients on your WHMCS installation. |
Configuration | WHMCS settings. |
Contacts (Client's contacts) | Contacts on your clients account. |
Currencies | Currencies on your WHMCS installation. |
Products (Packages) | Packages on your WHMCS. |
Services | Services created on your customers. |
Support Tickets | Support tickets created on WHMCS. |
Importing from WHMCS
Preparing WHMCS (If importing from your live WHMCS installation)
- Make sure you have completed the Initial Steps for Migrating to Blesta.
- Stop the cron job running for your WHMCS installation.
- Put WHMCS into maintenance mode to prevent client logins by visiting [Setup] > [General Settings] > [General].
- Back up your WHMCS files. You can do this via an FTP program, or via a shell by running: zip -r backup.zip /path/to/installation/*
- Back up your WHMCS database. You can do this through a database manager like PHPMyAdmin using the "Export" feature, or with the mysqldump shell command by running: mysqldump -u database_username -p database_name -r backup.sql and entering your database password when prompted.
Performing the Import
Importing via CLI
Importing via CLI is recommended especially if there is a significant amount of data. Navigate to your Blesta installation directory and run the following command, replacing the variables.
- DBHOST with your database hostname
- DBNAME with your database name
- DBUSER with your database user
- DBPASS with your database pass
- CCENCRYPTIONHASH with your CC Encryption Hash
- If you don't want to balance credits (recommended), change to 'n'.
- If you don't want to enable debug, change to 'n'
Use the -h switch to show all options: php index.php admin/plugin/import_manager/admin_manage_plugin/index -h
php index.php admin/plugin/import_manager/admin_manage_plugin/index --type whmcs --version 8.0 --host DBHOST --database DBNAME --user DBUSER --pass DBPASS --key CCENCRYPTIONHASH --balance_credit y --enable_debug y
Importing via Web
- Visit [Settings] > [Company] > [Plugins] > Installed and click "Manage" for the Import Manager.
- Click the "5.2" link next to the platform WHMCS.
- Fill out all of the requested fields
- Database Host: Enter your WHMCS database server name. If MySQL is running on the same server, use localhost
- Database Name: Enter the name of your WHMCS database.
- Database User: Enter the user name for your WHMCS database.
- Database Password: Enter the password associated with your WHMCS database user.
- CC Encryption Hash: Enter the CC Encryption Hash as found in your WHMCS configuration.php. This is required in order to decrypt encrypted data stored in your WHMCS installation.
- Double check that the data is all correct, and click the "Continue" button.
- You will be prompted to allow the importer to import your packages into Blesta, or match them up. It's recommended that you go with the default setting and import the packages, however, advanced users may wish to create their packages in Blesta first and match them up.
- Submit the form to start the import.
Importing can take a while
Importing your data can take several minutes or more, please be patient. When the importer has finished, it will display a green success message.
Tickets
Because you are logged into a new staff account while performing the import, imported tickets will not appear to you by default. Go to Support > Staff, click the [+] button to add your staff user to all departments. Select Administrators for Staff Group, then your Staff Member, and assign yourself to all departments by moving them from Available Departments to Assigned Departments.
Enabling Legacy Passwords
In order for clients to log into Blesta after being imported, you must enable legacy passwords in Blesta. When a client logs in, their password will be converted automatically to a more secure hash.
To enable support for these passwords edit the /config/blesta.php configuration file within your Blesta installation and change
Configure::set("Blesta.auth_legacy_passwords", false); Configure::set("Blesta.auth_legacy_passwords_algo", "md5");
To:
Configure::set("Blesta.auth_legacy_passwords", true); Configure::set("Blesta.auth_legacy_passwords_algo", "whmcs");
Blesta < 4.9
If your Blesta installation is less than version 4.9, use the following instead. Please note that importing modern bcrypt password hashes from WHMCS only works with Blesta 4.9 or greater.
Configure::set("Blesta.auth_legacy_passwords", true); Configure::set("Blesta.auth_legacy_passwords_algo", "whmcs-md5");
Then save the file. After a sufficient amount of time has passed, you may change this setting back.
PayPal Subscriptions
Do you have any active PayPal Subscriptions?
PayPal Subscriptions
If you have any active PayPal Subscriptions in WHMCS, they will not automatically work with Blesta. Beginning with Blesta 3.5, PayPal Subscriptions can be maintained by creating a redirect in your .htaccess file. At the beginning of the file, add the following:
Redirect 301 /modules/gateways/callback/paypal.php /callback/gw/1/paypal_payments_standard/
This redirect may need to be adjusted depending on your path to paypal.php in your WHMCS and your Blesta installation directory. Also, the 1 in /callback/gw/1/paypal_payments_standard/ references the company ID in Blesta. If you do not have any addon companies, then the company ID is 1. Note that normally the IPN URL for each client is unique, and look something like /callback/gw/1/paypal_payments_standard/?client_id=12345 where 12345 is the internal ID for the client. If this is ID is missing, Blesta attempts to match the transaction to a client based on the client's email address. If there is no match on the client's email address, the transaction will not be recorded.
Return to complete the Final Steps.
Common Errors
Error:
Array ( [email] => Array ( [format] => Please enter a valid email address. ) )
Solution:
It's likely your WHMCS install is missing email address, or that the domain in some email addresses is invalid (No MX name resolution). To get around this, you can edit /vendors/minphp/input/src/Input.php and find the isEmail method. Replace the method with the following:
public static function isEmail($str, $check_record = true) { return true; }
This will stop Blesta from performing any input validation on email addresses. Be sure to revert the change after the import has completed.