Please wait...

Migrating MailWizz to a new server

In order to move MailWizz from a server onto another, you’ll have to first create a backup of your files and database.
You can do this from CPanel, from command line, or by using MailWizz backup manager tool.
Once you have the backup in place, move it onto the new server in your domain public html folder (unzip it on the server first if need be).

After the files are uploaded in place, you will have to import the existing database into your new server(command line or phpmyadmin) and then edit the configuration file to reflect the new database data. The configuration file you need to edit is located at “apps/common/config/main-custom.php“.
Next, you’ll have to make sure following folders are writable by the web server: (chmod -R 0777)


And finally, make sure you add your cron jobs on the new server. You can find the list of cron jobs you have to add here.
That’s pretty much it.

Doing the above steps from command line will be the easiest and here are the steps to do it, in big lines to give you an idea:
We will assume that on the old server, MailWizz files are located in /home/mailwizz-old/public_html/ and on the new server the files are located in /home/mailwizz-new/public_html.

On the old server:

# change directory to MailWizz home folder
cd /home/mailwizz-old

# create an archive out of the entire public_html folder
tar -pczf backup.tar.gz public_html

# create a database backup

# running a ls -al in /home/mailwizz-old we should see both, backup.tar.gz and backup.sql files.

#additionally, you can move these two files into a public accessible location on the old server so that you can download them when you are on the new server

# create a temp dir
mkdir /home/mailwizz-old/public_html/tempdownload

#move files into it
mv /home/mailwizz-old/backup.tar.gz /home/mailwizz-old/public_html/tempdownload/
mv /home/mailwizz-old/backup.sql /home/mailwizz-old/public_html/tempdownload/

On the new server:

# change directory to the new home
cd /home/mailwizz-new

#fetch the files from old server:

# untar the files, will extract the public_html directory which will override the existing public_html directory
tar -zxvf backup.tar.gz

#import the database

# adjust the configuration of the app to reflect the new database.
# Make sure you edit the below file and add right data:
nano /home/mailwizz-new/public_html/apps/common/config/main-custom.php

# make sure the needed folders are writable, we have already a shell script for this:
# step 1, make it executable
chmod +x /home/mailwizz-new/public_html/apps/console/commands/shell/set-dir-perms
# step 2, execute it

#finally, add the cron jobs:
#find the php binary, should return something like /usr/bin/php
which php

# make sure it is the CLI binary, you should see (cli) word in the output of the command:
/usr/bin/php -v

# open crontab in edit mode to add the cron jobs:
crontab -e

# and write the crons:

# Campaign sender, runs each minute:
* * * * * /usr/bin/php -q /home/mailwizz-new/public_html/apps/console/console.php send-campaigns >/dev/null 2>&1

# Transactional emails sender, runs once at 2 minutes: (since
*/2 * * * * /usr/bin/php -q /home/mailwizz-new/public_html/apps/console/console.php send-transactional-emails >/dev/null 2>&1

# Bounce handler, runs once at 10 minutes:
*/10 * * * * /usr/bin/php -q /home/mailwizz-new/public_html/apps/console/console.php bounce-handler >/dev/null 2>&1

# Feedback loop handler, runs once at 20 minutes:
*/20 * * * * /usr/bin/php -q /home/mailwizz-new/public_html/apps/console/console.php feedback-loop-handler >/dev/null 2>&1

# Process delivery and bounce logs, runs once at 3 minutes:
*/3 * * * * /usr/bin/php -q /home/mailwizz-new/public_html/apps/console/console.php process-delivery-and-bounce-log >/dev/null 2>&1

# Cleanup command to run daily:
0 0 * * * /usr/bin/php -q /home/mailwizz-new/public_html/apps/console/console.php daily >/dev/null 2>&1

That’s it.