Clearing the cache broke mautic

Your software
My Mautic version is: 4.4.7
My PHP version is: 8.0

Your problem
I cleared the cache according to the docs and ran

ssh-w****2@d****8:/www/htdocs/w****2/mautic$ rm -rf var/cache/*`.

Now I’m getting this errror in the backend:

The site is currently offline due to encountering an error. If the problem persists, please contact the system administrator.

In the terminal I’m getting:

ssh-w****2@d****8:/www/htdocs/w****2/mautic$ php80 bin/console cache:warmup
PHP Warning:  Undefined array key "class" in /www/htdocs/w019eff2/mautic/app/bundles/CoreBundle/DependencyInjection/MauticCoreExtension.php on line 119

Warning: Undefined array key "class" in /www/htdocs/w019eff2/mautic/app/bundles/CoreBundle/DependencyInjection/MauticCoreExtension.php on line 119
PHP Warning:  Undefined array key "class" in /www/htdocs/w019eff2/mautic/app/bundles/CoreBundle/DependencyInjection/MauticCoreExtension.php on line 120

Warning: Undefined array key "class" in /www/htdocs/w019eff2/mautic/app/bundles/CoreBundle/DependencyInjection/MauticCoreExtension.php on line 120

In ContainerBuilder.php line 842:
                         
  Invalid alias id: "". 

If I’m using PHP7.4 I’m getting just:

ssh-w****2@d****8:/www/htdocs/w****2/mautic$ php74 bin/console 

In ContainerBuilder.php line 842:
                         
  Invalid alias id: "".

This is not a permission problem. As the ssh user and the www-user are set up to be almost identical. In every other case I can happily create/delte files via ssh or the server without running into any problems.

Plus I tried to access the web backend before using the ssh terminal session. So, the www-user should have created the files, which can’t lead to a permission problem.

But to be double safe, I executed:

find . -type f -not -perm 644 -exec chmod 644 {} +
find . -type d -not -perm 755 -exec chmod 755 {} +
chmod -R g+w var/cache/ var/logs/ app/config/
chmod -R g+w media/files/ media/images/ translations/
ssh-w******2@d******8:/www/htdocs/w******2/mautic$ whoami 
ssh-w******2
ssh-w******2@d******8:/www/htdocs/w******2/mautic$ ls -l
total 4484
drwxr-xr-x  8 ssh-w******2 w******2    4096 Aug 26  2022 app
-rw-r--r--  1 ssh-w******2 w******2      54 Mär 18 23:36 autoload.php
drwxr-xr-x  2 ssh-w******2 w******2    4096 Dez 21  2021 bin
-rw-r--r--  1 ssh-w******2 w******2       2 Mär 18 23:36 critical_migrations.txt
-rw-r--r--  1 ssh-w******2 w******2   12862 Mär 18 23:36 favicon.ico
-rw-r--r--  1 ssh-w******2 w******2     621 Mär 18 23:36 index.php
-rw-r--r--  1 ssh-w******2 w******2   38346 Mär 18 23:36 LICENSE.txt
drwxr-xr-x  7 ssh-w******2 w******2    4096 Nov 18 13:24 media
-rw-r--r--  1 ssh-w******2 w******2    4043 Mär 18 23:36 offline.php
-rw-r--r--  1 ssh-w******2 w******2 4472565 Mär 18 23:36 phpstan-baseline.neon
drwxr-xr-x 16 ssh-w******2 w******2    4096 Apr 17 21:44 plugins
-rw-r--r--  1 ssh-w******2 w******2     224 Mär 18 23:36 robots.txt
-rw-r--r--  1 ssh-w******2 w******2    6087 Mär 18 23:36 SECURITY.md
drwxr-xr-x 24 ssh-w******2 w******2    4096 Dez 27  2021 themes
drwxrwxr-x  4 ssh-w******2 w******2    4096 Jan 17  2022 translations
drwxr-xr-x  6 ssh-w******2 w******2    4096 Nov 29  2021 var
drwxr-xr-x 75 ssh-w******2 w******2    4096 Jul  4  2022 vendor
ssh-w******2@d******8:/www/htdocs/w******2/mautic$ ls -l var/
total 16
drwxrwxr-x 3 ssh-w******2 w******2 4096 Mai 13 14:58 cache
drwxrwxr-x 2 ssh-w******2 w******2 4096 Mai 13 03:43 logs
drwxr-xr-x 2 ssh-w******2 w******2 4096 Mai 12 15:11 spool
drwxr-xr-x 5 ssh-w******2 w******2 4096 Mär 19 10:43 tmp

The asterisks omit identical chars for the user and group.

Hi, can you delete the cache one again with the following:

rm -rf var/cache/*

and then create folder:

mkdir -p var/cache/prod

then ensure the above folder is writable by web server user.

Execute the following:

composer dump-autoload

Then, I would suggest reloading the plugins:

php bin/console mautic:plugins:reload

I hope it helps.

Thanks for your reply.

Did all the steps except composer dump-autoload as it is an older non-composer installation.

It didn’t help.

As of now, I strongly suspect the line

In ContainerBuilder.php line 842:
                         
  Invalid alias id: "".  

Is the root. How/where could I have accidentally set an empty id?

Do you have any custom plugins, did you alter any of existing plugins in the core?

composer dump-autoload has to do with vendor folder. Download composer files from mautic repop:

https://github.com/mautic/mautic/blob/4a897bf90b29e7461680788251e30f416a2c56b0/composer.lock

and try to execute composer command.

Before that make sure you have composer installed.

1 Like

That was the answer. I added an experimental custom plugin I’m working on. Obviously it wasn’t a problem until I cleared the cache.

I removed it and cleared the cache again. It works now.

Learned a valuable lesson, today :smiley: :man_facepalming:

Thank you so much!

3 Likes

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