"Undefined class constant" Error after upgrade

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’

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 :slight_smile:
Joey

2 Likes

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.

1 Like

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?

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

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

Hi @ mzagmajster 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

config/local.php is probably missing

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

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

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.

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