# Upgrade v2.16.0 to v3.0.2

**URL:** <https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404>\
**Category:** Mautic 3 - Install/Upgrade Support\
**Created:** [July 27, 2020, 12:04pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404 "2020-07-27T12:04:58Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![voisd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/voisd/32/2900_2.png) [@voisd](https://forum.mautic.org/u/voisd)\
**Post date:** [July 27, 2020, 12:04pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/1 "2020-07-27T12:04:58Z")

</div>

**Your software**  
_My PHP version is_ : 7.3

I’m want to upgrade from v2.16.0 to v3.0.2 - I’ve read the following [https://docs.mautic.org/en/mautic-3-upgrade/upgrade-steps](https://docs.mautic.org/en/mautic-3-upgrade/upgrade-steps) however this is specifically for upgrading from v2.16.3 or above.

What is the best approach?

Do i need to upgrade to a v2 build e.g. v2.16.3 and then do a further upgrade to v3.0.2 or can I upgrade straight from current to latest version?

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [July 27, 2020, 12:38pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/2 "2020-07-27T12:38:46Z")

</div>

You must update first to 2.16.3 - there is no other upgrade path. See the pre-flight check:

> - Do you at least have Mautic 2.16.3 installed?

So you will need to do 2.16.0 → 2.16.3 and then you can upgrade to 3.x. Of course, ensuring that you have a backup that is tested, and ideally at the command line.

---

<div class="post-metadata">

**Author:** ![voisd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/voisd/32/2900_2.png) [@voisd](https://forum.mautic.org/u/voisd)\
**Post date:** [July 27, 2020, 3:38pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/3 "2020-07-27T15:38:19Z")

</div>

To confirm the update that is needed initially is this the 2.16.3-update.zip from this page:

> **[Release 2.16.3 · mautic/mautic](https://github.com/mautic/mautic/releases/tag/2.16.3)**
>
> Mautic 2.16.3 release for upgrading to Mautic 3 🚀
> The only thing that this version introduces is a special upgrade script for Mautic 3. Mautic 3 is now considered stable enough to allow upgrades fr...

Then it’s a case of upgrading using the published steps at:

> **[Upgrade steps](https://docs.mautic.org/en/mautic-3-upgrade/upgrade-steps?_ga=2.223404062.486871931.1595849546-1786381583.1595528670)**
>
> If you want to know more about all the upgrade steps of the Mautic 3 upgrade process, this is the place to be.The upgrade process consists of multiple steps to make it as robust as possible. If the process fails at a certain step, you can find all...

Correct?

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [July 27, 2020, 3:52pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/4 "2020-07-27T15:52:13Z")

</div>

Just use the command:

`mautic:update:find`

followed by

`mautic:update:apply`

per the docs here: [https://docs.mautic.org/en/setup/updating-at-command-line#checking-for-updates](https://docs.mautic.org/en/setup/updating-at-command-line#checking-for-updates)

You will not be offered the 3.x packages unless you are on 2.16.3 so it is fine to use the regular update commands.

Once. at 2.16.3 run the commands again, it will take you through the migration step by step at the command line when you do the update.

---

<div class="post-metadata">

**Author:** ![voisd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/voisd/32/2900_2.png) [@voisd](https://forum.mautic.org/u/voisd)\
**Post date:** [July 27, 2020, 4:57pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/5 "2020-07-27T16:57:06Z")

</div>

Great, that all makes sense.

I’ve had to substitute php bin/console mautic:update:find for php app/console mautic:update:find but that has started the process.

It’s unpacked but then thrown up the following:

> [Symfony\Component\Debug\Exception\FatalThrowableError]  
> Type error: Argument 1 passed to Mautic\CoreBundle\Helper\LanguageHelper::\_\_construct() must be an instance of Mautic\CoreBundle\Helper\PathsHelper, instance of Mautic\CoreBundle\Factory\MauticFactory given, called in /home/per/email.domain.com/app/cache/prod/appProdProjectContainer.php on line 11412

There are then the options:

> mautic:update:apply [–force] [-p|–update-package [UPDATE-PACKAGE]] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-s|–shell] [–process-isolation] [-e|–env ENV] [–no-debug] [–]

 ![chrome_WycTvRbRLM](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/2/2d280d2fb585022b87e1be9fc1fea153db5db18c.png)

---

<div class="post-metadata">

**Author:** ![voisd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/voisd/32/2900_2.png) [@voisd](https://forum.mautic.org/u/voisd)\
**Post date:** [July 29, 2020, 7:52pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/7 "2020-07-29T19:52:40Z")

</div>

@silavapi any help/input from your end massively appreciated.

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [July 30, 2020, 2:18pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/8 "2020-07-30T14:18:11Z")

</div>

Hi there,

Search is your friend … it turned up this thread: [Impossible to update from 2.16.0](https://forum.mautic.org/t/impossible-to-update-from-2-16-0/14858/6).

Try changing the language of your instance to en\_US?

---

<div class="post-metadata">

**Author:** ![voisd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/voisd/32/2900_2.png) [@voisd](https://forum.mautic.org/u/voisd)\
**Post date:** [July 30, 2020, 2:44pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/9 "2020-07-30T14:44:42Z")

</div>

Seemingly the language is already set to English - United States

 ![chrome_LFc7cgHIop](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/6/6d1b60127ef0727214a9321719fe1fc198442984.png) !

Hmmmm…

Any further ideas/suggestions?

Is it worth deleting the contents of **/home/per/email.domain.com/app/cache** perhaps?

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [July 30, 2020, 2:46pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/10 "2020-07-30T14:46:21Z")

</div>

Yes, deleting the cache is a good starting point!

---

<div class="post-metadata">

**Author:** ![voisd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/voisd/32/2900_2.png) [@voisd](https://forum.mautic.org/u/voisd)\
**Post date:** [July 30, 2020, 3:05pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/11 "2020-07-30T15:05:56Z")

</div>

Very strange, although I unpacked previously but didn’t proceed with the upgrade via Terminal, today it’s now showing that Mautic is running 2.16.3 (weird).

So I’ve run **php upgrade\_v3.php**

Then run **yes** to proceed.

It then says that there is a warning due to pending emails not sent (that i’m not worried about) and that it can’t make a database backup due to restrictions on the system.

It then says **only continue if you have your own database backup available!** which I do, however I’m unsure what command to run to continue the update…

 ![chrome_1fDvoJ3DYX](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/0/0263e1c3dc3226a3137a7d8cc6b24894c196d70a.png)

---

<div class="post-metadata">

**Author:** ![dennisameling](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dennisameling/32/958_2.png) [@dennisameling](https://forum.mautic.org/u/dennisameling)\
**Post date:** [July 30, 2020, 7:26pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/12 "2020-07-30T19:26:50Z")

</div>

@voisd you can run `php upgrade_v3.php --ignore-warnings` which skips these warnings and proceeds with the upgrade. Hope that helps 😊

---

<div class="post-metadata">

**Author:** ![voisd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/voisd/32/2900_2.png) [@voisd](https://forum.mautic.org/u/voisd)\
**Post date:** [July 30, 2020, 9:37pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/13 "2020-07-30T21:37:41Z")

</div>

Ok, so that got it going, it got a little way into the upgrade and then flagged a DROP FOREIGN KEY error.

> ALTER TABLE maukf\_lead\_event\_log DROP FOREIGN KEY FK\_A73AD4C755458D  
> Migration 20180329185634 failed during Execution. Error An exception occurred while executing ‘ALTER TABLE maukf\_lead\_event\_log DROP FOREIGN KEY FK\_A73AD4C755458D’:
> 
> Can’t DROP FOREIGN KEY `FK_A73AD4C755458D`; check that it exists
> 
> [Doctrine\DBAL\Exception\DriverException]  
> An exception occurred while executing ‘ALTER TABLE maukf\_lead\_event\_log DROP FOREIGN KEY FK\_A73AD4C755458D’:
> 
> Can’t DROP FOREIGN KEY `FK_A73AD4C755458D`; check that it exists
> 
> [Doctrine\DBAL\Driver\Mysqli\MysqliException]  
> Can’t DROP FOREIGN KEY `FK_A73AD4C755458D`; check that it exists
> 
> doctrine:migrations:migrate [–write-sql] [–dry-run] [–query-time] [–allow-no-migration] [–configuration [CONFIGURATION]] [–db-configuration [DB-CONFIGURATION]] [–db DB] [–em EM] [–shard SHARD] [-h|–help] [-q|–quiet] [-v|vv|vvv|–verbose] [-V|–version] [–ansi] [–no-ansi] [-n|–no-interaction] [-s|–shell] [–process-isolation] [-e|–env ENV] [–no-debug] [–] []

Any next step suggestions?

---

<div class="post-metadata">

**Author:** ![voisd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/voisd/32/2900_2.png) [@voisd](https://forum.mautic.org/u/voisd)\
**Post date:** [August 1, 2020, 3:40pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/14 "2020-08-01T15:40:07Z")

</div>

I’ve since:

Run the steps [from this article](https://johnlinhart.com/blog/uh-oh-mautic-upgrade-was-not-successful) however stopped prior to trying to update files manually at this stage.

Attempt to add the appropriate missing key ([as stated in this article](https://github.com/mautic/mautic/issues/6134#issuecomment-437827628)) however all I managed to get was the folllow mySQL error.

 ![chrome_SiUTxjZjZn](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/0/0c08d3fc605ac4ff7be87d31b110add729b09e2b.png)

Any thoughts/suggestions?

---

<div class="post-metadata">

**Author:** ![dennisameling](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dennisameling/32/958_2.png) [@dennisameling](https://forum.mautic.org/u/dennisameling)\
**Post date:** [August 14, 2020, 12:58pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/15 "2020-08-14T12:58:13Z")

</div>

@voisd Apologies for the late reply.

The migration 20180329185634 belongs to Mautic 2, which means that your upgrade is stuck in step 3 of the process: [https://docs.mautic.org/en/mautic-3-upgrade/upgrade-steps#3-apply-mautic-2-database-migrations](https://docs.mautic.org/en/mautic-3-upgrade/upgrade-steps#3-apply-mautic-2-database-migrations). At this stage, you can still use your Mautic 2 installation as if nothing has happened.

This migration should have been executed in the past already, because it’s two years old: [https://github.com/mautic/mautic/tree/2.16/app/migrations](https://github.com/mautic/mautic/tree/2.16/app/migrations) - weird that that didn’t happen on your installation.

In order to proceed, we need all database migrations for Mautic 2 executed on your instance. You can trigger that process with `app/console doctrine:migrations:migrate`, which will most likely give you the error you posted above.

I looked at the specific migration and can you please do the following:

1. Open `app/migrations/Version20180329185634.php`
2. Remove line 32, which has this code in it:  
`$this->addSql("ALTER TABLE {$this->prefix}lead_event_log DROP FOREIGN KEY $fkName");` --\> **please don’t touch other parts of this file**!
3. Run `app/console doctrine:migrations:migrate` again. Fingers crossed you won’t see any other errors now 🤞
4. If the migrations succeeded, try to open the Mautic 3 upgrade script again.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![voisd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/voisd/32/2900_2.png) [@voisd](https://forum.mautic.org/u/voisd)\
**Post date:** [August 14, 2020, 1:48pm UTC](https://forum.mautic.org/t/upgrade-v2-16-0-to-v3-0-2/15404/16 "2020-08-14T13:48:49Z")

</div>

That seems to have done the job - now successfully running 3.0.1 - thanks for your help 😃
