# "Undefined class constant" Error after upgrade

**URL:** <https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131>\
**Category:** Product Support\
**Created:** [August 14, 2024, 9:18am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131 "2024-08-14T09:18:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonio-lazzari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/antonio-lazzari/32/737_2.png) [@antonio-lazzari](https://forum.mautic.org/u/antonio-lazzari)\
**Post date:** [August 14, 2024, 9:18am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/1 "2024-08-14T09:18:42Z")

</div>

I customer of mine try to upgrade form 4.x to 5.x through cli whitout asking a month ago. Now the sistem is unreachable and they haven’t backup. Do you think there is any chance of recovering it?

This is the error in cli while I try any command (also after a cache cleaned by rm command):

In FileLoader.php line 208:

Expected to find class “Mautic\ApiBundle\Config\config” in file “/home/…/app/bundles/ApiBundle/Config/config.php” while importing services from resource “…/”, but it was not found! Check the namespace prefix used with the resource.

In services.php line 23:

Undefined class constant ‘DEFAULT\_EXCLUDES’

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [August 16, 2024, 3:39pm UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/2 "2024-08-16T15:39:33Z")

</div>

Hello Antonio!

What I would do:

1. Install Mautic 5.1 on a new server
2. Copy old DB and move it over to new server
3. Copy old media folder as well
4. Run Mautic 5.1 migrations, so your M4 DB is pulled up to M5.1 levels.

I think this should work 🙂  
Joey

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [August 18, 2024, 11:48am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/3 "2024-08-18T11:48:57Z")

</div>

While Joey’s solution should work, the issue seems to only be in the source code.

Perhaps this procedure is even better in this case:

- backup current mautic source somewhere on the server
- check the version of mautic, go to Mautic GH release page and download fresh source on to the server
- extract the source on the server
- put config and & media folders from backup to this fresh mautic source
- clear the cache

No need to install it on another server or re-run migrations.

Best, M.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [August 20, 2024, 7:27am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/4 "2024-08-20T07:27:54Z")

</div>

I have a quick question about M4 config. Is it 100% compatible with M5 config? Is just the transport setting that needs some manual changes?

---

<div class="post-metadata">

**Author:** ![antonio-lazzari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/antonio-lazzari/32/737_2.png) [@antonio-lazzari](https://forum.mautic.org/u/antonio-lazzari)\
**Post date:** [August 20, 2024, 8:06am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/5 "2024-08-20T08:06:19Z")

</div>

Thanks a lot I’ll try your both solutions in a few days, I’ll be back here for response…

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [August 20, 2024, 8:15am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/6 "2024-08-20T08:15:23Z")

</div>

No not really based on my experience. I had to actually reset entire config after one migration to mautic 5

---

<div class="post-metadata">

**Author:** ![antonio-lazzari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/antonio-lazzari/32/737_2.png) [@antonio-lazzari](https://forum.mautic.org/u/antonio-lazzari)\
**Post date:** [September 5, 2024, 8:08am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/7 "2024-09-05T08:08:40Z")

</div>

Hi @ [mzagmajster](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/3) I try your solution as you suggest. I move from backup these folders:  
Config  
Cron  
Media  
Template  
Theme  
But when I try to enter it starts the installation procedure. Do you know where is the check of this step? I cant find it.  
Thanks a lot

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [September 5, 2024, 8:33am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/8 "2024-09-05T08:33:52Z")

</div>

config/local.php is probably missing

---

<div class="post-metadata">

**Author:** ![antonio-lazzari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/antonio-lazzari/32/737_2.png) [@antonio-lazzari](https://forum.mautic.org/u/antonio-lazzari)\
**Post date:** [September 5, 2024, 9:03am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/9 "2024-09-05T09:03:29Z")

</div>

No I verify and it is in the folder and is the correct one.  
Really I can’t understand

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [September 5, 2024, 10:21am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/10 "2024-09-05T10:21:13Z")

</div>

I can look into it tomorrow if you want, drop me a DM

---

<div class="post-metadata">

**Author:** ![antonio-lazzari](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/antonio-lazzari/32/737_2.png) [@antonio-lazzari](https://forum.mautic.org/u/antonio-lazzari)\
**Post date:** [September 6, 2024, 8:44am UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/11 "2024-09-06T08:44:37Z")

</div>

Thanks to @mzagmajster now all work fine.  
I had not copied the file:

…/app/config/local.php

but only the file

…/config/local.php

Cleared the cache everything went online perfectly.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/1X/43c63600fe51440378769136903f1fa2a9a34102.png) [@system](https://forum.mautic.org/u/system)\
**Post date:** [September 7, 2024, 8:45pm UTC](https://forum.mautic.org/t/undefined-class-constant-error-after-upgrade/33131/12 "2024-09-07T20:45:25Z")

</div>

Closed on September 7, 2024, 8:45pm UTC

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.
