If you are still on Mautic 2.+, you should put yourself together and upgrade as soon as possible. There is really no reason to stay on the 2.+ infrastructure, unless you use old plugins, that are not any more available for M3. But eventually the pros of upgrading will outweighs the cons anyway.

M3 comes with a bunch of cool features, stability improvements. I know the fear of the “Something went wrong” headline after upgrading, so I created a tutorial, that guides you through step by step.

There are a bunch of good tutorials out there, I’m not saying, this is the best one. But maybe watching it on video helps you through the steps.

Under the video you’ll find all the commands I used for the upgrade. Enjoy.

Preparations

Fix data migrations

sudo php /var/www/html/mautic/app/console doctrine:migration:migrate
sudo php /var/www/html/mautic/app/console doctrine:schema:update --force
sudo -u www-data php /var/www/html/mautic/app/console cache:clear

Upgrade to 2.16.5 (If you haven’t yet)

cd /var/www/html/mautic
sudo -u www-data php app/console mautic:update:find
sudo -u www-data php app/console mautic:update:apply

Upgrade to PHP 7.3

sudo apt upgrade -y
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php
sudo apt update -y
sudo apt install php7.3
sudo apt install php7.3-common php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-curl php7.3-gd php7.3-imagick php7.3-cli php7.3-dev php7.3-imap php7.3-mbstring php7.3-opcache php7.3-soap php7.3-zip php7.3-intl -y

Edit your php ini file:

sudo nano /etc/php/7.3/apache2/php.ini

short_open_tag = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 300
post_max_size = 64M

Activate your php 7.3 and turn off 7.1

sudo a2enmod php7.3
sudo a2dismod php7.1
sudo systemctl restart apache2
php -v

New db install

Backup your DB

mysqldump -u root -p --all-databases > all-db.sql
psw: ysSmK3t87wyC

Remove old mariadb

sudo apt remove mariadb-server

Add new apt source

sudo apt install software-properties-common -y
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo nano /etc/apt/sources.list.d/mariadb.list

Add:

deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main
deb-src http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main

Update and install:

sudo apt update
sudo apt install mariadb-server -y
exit

Remove Non-compatible plugins:

cd /var/www/html/mautic/
sudo -u www-data php /var/www/html/mautic/app/console mautic:update:find

Search for upgrade

(This step really depends on your installed and non-M3 compatible plugins.)

cd /var/www/html/mautic/plugins
rm -R GautitClearcacheBundle/
rm -R MauticAdvancedTemplatesBundle/
rm -R SmsreaderBundle/

OR you can just move them out from this folder

mv /var/www/html/mautic/plugins/GautitClearcacheBundle /var/www/html
mv /var/www/html/mautic/plugins/MauticAdvancedTemplatesBundle /var/www/html
mv /var/www/html/mautic/plugins/MauticRecaptchaBundle /var/www/html
mv /var/www/html/mautic/plugins/SmsreaderBundle /var/www/html

Install Mautic 3

sudo -u www-data php upgrade_v3.php

If you installed via composer originally, you’ll need to use this trick:

mv composer.json composer.json2
sudo -u www-data php upgrade_v3.php

If you get an error here, just make sure ownership and permissions are okay.

Then, let’s run the upgrade one more time:

sudo -u www-data php upgrade_v3.php

Look for new version (we just upgraded to 3.0) and update (to 3.+):

sudo -u www-data php /var/www/html/mautic/bin/console mautic:update:find
sudo -u www-data php /var/www/html/mautic/bin/console mautic:update:apply
sudo -u www-data php /var/www/html/mautic/bin/console mautic:update:apply --finish

Set ownership and clear cache

sudo chown -R www-data:www-data /var/www/html/mautic/
sudo chmod -R 755 /var/www/html/mautic/
sudo -u www-data php /var/www/html/mautic/bin/console cache:clear

Last steps:

Change your cronjobs from

/app/console

To:

/bin/console

If you would like to use the new Email Builder, go to plugins, click on install plugins and turn on the new builder.
You might need to log in and out before it’s actvated.

Let me know how did it go for you!

Leave a Reply

Your email address will not be published. Required fields are marked *