# Mautic went down after cache clearing

**URL:** <https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377>\
**Category:** Product Support\
**Created:** [March 30, 2022, 7:50am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377 "2022-03-30T07:50:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bekzada](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bekzada/32/7085_2.png) [@bekzada](https://forum.mautic.org/u/bekzada)\
**Post date:** [March 30, 2022, 7:50am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/1 "2022-03-30T07:50:40Z")

</div>

**Your software**  
My Mautic version is: V3.3.3  
My PHP version is: 7.3.27  
My Database type and version is: 2020.4

**Your problem**  
My problem is: Mautic went down after cache clearing

These errors are showing in the log: This page isn’t working

Steps I have tried to fix the problem: Reinstalled Mautic 2 times, checked all database issues and fixed

---

<div class="post-metadata">

**Author:** ![wlsfh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/wlsfh/32/6731_2.png) [@wlsfh](https://forum.mautic.org/u/wlsfh)\
**Post date:** [March 30, 2022, 11:28am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/2 "2022-03-30T11:28:42Z")

</div>

Same issue here.  
I’m on Mautic to latest release 4.2.1, PHP-FPM 7.4, MariaDB.

After updating everything was fine.  
Then I regenerated assets and seems the dashboard is broken, JS stuck and not loading.  
(screenshot here [Screenshot by Lightshot](https://prnt.sc/6Pd3FuBnpOTf))

I noticed the following errors:

Uncaught ReferenceError: Mousetrap is not defined  
at Object.addKeyboardShortcut (app.js:9:241)  
at Object.bindGlobalKeyboardShortcuts (app.js:10:173)  
at Object.Mautic.onPageLoad (app.js:83:57)  
at dashboard:513:20

I have reinstalled the package, reset permissions, cleared cache multiple times, but doesn’t seem to come up.  
To navigate through the menu I need to manually edit the URL.

---

<div class="post-metadata">

**Author:** ![wlsfh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/wlsfh/32/6731_2.png) [@wlsfh](https://forum.mautic.org/u/wlsfh)\
**Post date:** [March 30, 2022, 11:46am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/3 "2022-03-30T11:46:34Z")

</div>

For now it seems I’ve fixed it by rolling back to 4.2 and NOT changing user:group to the Mautic folder (so I’ve got a mix of root and mautik permissions).

---

<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:** [March 30, 2022, 12:57pm UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/4 "2022-03-30T12:57:51Z")

</div>

Hi, this comes up often, you should check who is running the webserver.  
Here is a comprehensive guide covering cache, permissions and assets.

> **[Full guide to permissions and cache in Mautic – Joey Keller](https://joeykeller.com/full-guide-to-permissions-and-cache-in-mautic/)**

---

<div class="post-metadata">

**Author:** ![bekzada](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bekzada/32/7085_2.png) [@bekzada](https://forum.mautic.org/u/bekzada)\
**Post date:** [March 31, 2022, 3:42am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/5 "2022-03-31T03:42:40Z")

</div>

![Screen Shot 2022-03-31 at 09.40.24](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/d/d7adc560e5dee43aaeb0ad402ff97a6966d950c4.png)  
Horraayy! Thanks for the article! That was very helpful, but what can I do with the server now? Shall I reinstall or any other solutions?

---

<div class="post-metadata">

**Author:** ![wlsfh](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/wlsfh/32/6731_2.png) [@wlsfh](https://forum.mautic.org/u/wlsfh)\
**Post date:** [March 31, 2022, 12:11pm UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/6 "2022-03-31T12:11:55Z")

</div>

Brilliant!  
Well done and thanks for taking time writing this down.

My only concern is this:  
‘That is the equivalent of running around with two active nuclear warheads ducktaped to your arms in a porcelaine store while walking on lego blocks’.

If you hear a blast it might have been my sudo user.

---

<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:** [March 31, 2022, 1:59pm UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/7 "2022-03-31T13:59:39Z")

</div>

Lol 🙂 careful. Great power comes with great responsibiliy.

---

<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:** [March 31, 2022, 1:59pm UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/8 "2022-03-31T13:59:58Z")

</div>

You confused me now. Did it work or not?

---

<div class="post-metadata">

**Author:** ![bekzada](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bekzada/32/7085_2.png) [@bekzada](https://forum.mautic.org/u/bekzada)\
**Post date:** [April 3, 2022, 8:11am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/9 "2022-04-03T08:11:37Z")

</div>

Cache for the prod environment was successfully warmed but Mautic still down, so probably didn’t work, what shall I do?

---

<div class="post-metadata">

**Author:** ![god\_of\_blunder](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/god_of_blunder/32/7291_2.png) [@god\_of\_blunder](https://forum.mautic.org/u/god_of_blunder)\
**Post date:** [April 3, 2022, 8:06pm UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/10 "2022-04-03T20:06:49Z")

</div>

Hi, I am real noob, so apologies if this is dumb, but is it because these commands are reversed in Joeyk’s otherwise excellent guide?

find . -type f -not -perm 644 -exec chmod 644 {} +  
find . -type d -not -perm 755 -exec chmod 755 {} +

ie should be

find . -type d -not -perm 644 -exec chmod 644 {} +  
find . -type f -not -perm 755 -exec chmod 755 {} +

---

<div class="post-metadata">

**Author:** ![bekzada](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bekzada/32/7085_2.png) [@bekzada](https://forum.mautic.org/u/bekzada)\
**Post date:** [April 4, 2022, 4:32am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/11 "2022-04-04T04:32:09Z")

</div>

> [@god\_of\_blunder](#):
>
> find . -type d -not -perm 755 -exec chmod 755 {} +

 ![Screen Shot 2022-04-04 at 10.31.21](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/1/1ec76877e76a0f03fbf2e2302fece2d2a6717ae4.png)  
nothing changed, what to do next?

---

<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:** [April 4, 2022, 8:06am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/12 "2022-04-04T08:06:41Z")

</div>

can you do an

`ls -la`

---

<div class="post-metadata">

**Author:** ![bekzada](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bekzada/32/7085_2.png) [@bekzada](https://forum.mautic.org/u/bekzada)\
**Post date:** [April 4, 2022, 9:44am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/13 "2022-04-04T09:44:23Z")

</div>

![Screen Shot 2022-04-04 at 15.43.52](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/5/51449ac1bcdb45a38dea580cfd170c8189c0ca2d.png)  
next?

---

<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:** [April 4, 2022, 9:52am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/14 "2022-04-04T09:52:11Z")

</div>

You are fine here, we should see your apache / nginx log.

> **[How to View and Configure NGINX Access & Error Logs | Better Stack Community](https://betterstack.com/community/guides/logging/how-to-view-and-configure-nginx-access-and-error-logs/)**
>
> Learn how to view and configure nginx access and error logs

> **[How to View and Configure Apache Access & Error Logs | Better Stack...](https://betterstack.com/community/guides/logging/how-to-view-and-configure-apache-access-and-error-logs/)**
>
> Learn how to view and configure Apache access and error logs.

---

<div class="post-metadata">

**Author:** ![bekzada](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bekzada/32/7085_2.png) [@bekzada](https://forum.mautic.org/u/bekzada)\
**Post date:** [April 5, 2022, 4:54am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/15 "2022-04-05T04:54:47Z")

</div>

![Screen Shot 2022-04-05 at 10.53.58](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/a/a4249b9180e56faad42f78da80609b44bbf368b2.png)  
No such file or directory, how to find it?

---

<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:** [April 5, 2022, 5:31am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/16 "2022-04-05T05:31:29Z")

</div>

I think we can be more productive. Any chance you can come today 30 min earlier to the Mautic Meetup?

> **[Mautic Help Desk Meetup (Boston, MA)](https://www.meetup.com/mautic-helpdesk-meetup/)**
>
> Global and online-only! This free monthly meetup is for anyone who needs help in getting their Mautic questions answered and bringing their skills to the next level. Come and join us for an open oppor

Then I could take a look.

---

<div class="post-metadata">

**Author:** ![bekzada](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bekzada/32/7085_2.png) [@bekzada](https://forum.mautic.org/u/bekzada)\
**Post date:** [April 5, 2022, 6:17am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/17 "2022-04-05T06:17:35Z")

</div>

Yes, sure! I’ll come 30 minute earlier 👍

---

<div class="post-metadata">

**Author:** ![bekzada](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bekzada/32/7085_2.png) [@bekzada](https://forum.mautic.org/u/bekzada)\
**Post date:** [April 5, 2022, 3:33pm UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/18 "2022-04-05T15:33:07Z")

</div>

![Screen Shot 2022-04-05 at 21.32.16](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/0/01abfec31d55fc56ad89a6642c81ee6517fe61ba.png)  
I was waiting here, will it start earlier?

---

<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:** [April 5, 2022, 3:46pm UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/19 "2022-04-05T15:46:22Z")

</div>

Dropped you PM

---

<div class="post-metadata">

**Author:** ![bekzada](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/bekzada/32/7085_2.png) [@bekzada](https://forum.mautic.org/u/bekzada)\
**Post date:** [April 6, 2022, 7:05am UTC](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377/20 "2022-04-06T07:05:56Z")

</div>

Hello!

Thanks one more time for your help! Can you send me as a text how to avoid this to happen again please? How I understood yesterday I need to install a SSL, because people coming to the page and they want to use SSL and there’s no valid one and it looked like person with expired ID. So, need to install SSL and you can send me some commands which will be helpful to do it.

Also, how I understood steps are like that (correct me or write me the right explanation please):

1. Note for myself: don’t clear a cache with php bin/console cache:clear

And this is because of the permissions. So there is one virtual user who is responsible for running the web-show. ps aux | egrep ‘nginx’ and this user runs my webserver most likely apache or nginx.

1. When I tried to actually see what the name of this virtual user is. and I tried:

ps aux | egrep ‘(apache|httpd)’ So when I regerate my cache and run the **php bin/console cache:clear** command NOT as the **www-data** user, but for example **sudo** user I can run into problems. Sudo is the post powerful user on the server, and this command is the equvalent of the hotel director rewriting all the recipes, but not letting in anyone into the kitchen under his ranks.

1. Don’t just update or clear the cache in the name of any user. Especially if I am logged in as sudo. Even if I am sudo user, you can issue the commands as www-data user by using this format: sudo -u www-data php /var/www/html/mautic/app/console cache:clear
2. Once my permissions are already messed up, I can try any time fix it. Go to your Mautic folder, and:

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/

rm -rf var/cache/\*

This is like a general fix, I can run any time I have an issue with “unable to write” or “cannot be found” type of errors. I can also regerate the cache by warming it up: sudo -u www-data php bin/console cache:warmup

It gave me a nice green output, which means that everything should be okay:

“Cache for the “prod” environment (debug=false) was successfully warmed.”

1. Symfony also works with assets. These are not inclided in the cache, and I might need to regenerate them from time to time, after update when big changes have happened in the background. This solves issues like previously working fictions not working, like dropdown in segments. So Issued the right command: sudo -u www-data php bin/console mautic:assets:generate
2. So my steps combined and minifed asset files from each bundle into single production files. In other words: reseted big changes. But server was still down. I fixed permission issue with sudo chown -R www-data:www-data. And sudo chmod -R 775
3. Afterwards cd app/config ; and we deletes S in https site url
4. Cleared cache with rm -rf var/cache/\*  
I forgot what commands we used to open GNO nano5.4 and why we deleted S and why it caused a problem?

[Next page](https://forum.mautic.org/t/mautic-went-down-after-cache-clearing/23377.md?page=2)
