# Instance broken after clearing cache the wrong way. Reset permissions and owner does not help (yet)

**URL:** <https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041>\
**Category:** Product Support\
**Tags:** mautic-4\
**Created:** [November 11, 2022, 2:50pm UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041 "2022-11-11T14:50:06Z")\
**Posts on this page:** 10\
**Page:** 2

<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:** [November 11, 2022, 10:38pm UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041/21 "2022-11-11T22:38:44Z")

</div>

Your server is running with www-data right ? Then if you change everything to www-data there should spinn up the instance if everything is installed.

Can you set debug key to true in `app/config/local.php`, Then check the server logs. Also what message does it show in the browser?

---

<div class="post-metadata">

**Author:** ![vincent.fr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/vincent.fr/32/6600_2.png) [@vincent.fr](https://forum.mautic.org/u/vincent.fr)\
**Post date:** [November 11, 2022, 10:49pm UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041/22 "2022-11-11T22:49:11Z")

</div>

the last error message in var/logs/ (given the time stamp, I think it was before I change debug key to true)

```auto
[2022-11-11 22:29:26] mautic.NOTICE: PHP Notice - SessionHandler::gc(): ps_files_cleanup_dir: opendir(/var/lib/php/sessions) failed: Permission denied (13) - in file /var/www/html/mautic/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php - at line 106 {"maxlifetime":1440} {"hostname":"vps","pid":1249}

```

nginx is running as www-data (checked it once above). changed all to www-data (user and group). problem remains.

changed debug key to true in local.php. clear browser caches. reload browsers. problem remains.

waited for some minutes, the var/logs/ file does not show more errors.

on the browser, it says

```auto
This page isn’t working redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS

```

---

<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:** [November 11, 2022, 10:51pm UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041/23 "2022-11-11T22:51:48Z")

</div>

I do not think this issue with mautic, but with nginx configuration. Can you share your nginx config (you can do it via PM to not expose any sensitive data).

---

<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:** [November 11, 2022, 10:52pm UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041/24 "2022-11-11T22:52:44Z")

</div>

What happens if you try visit mautic in incognito mdoe?

---

<div class="post-metadata">

**Author:** ![vincent.fr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/vincent.fr/32/6600_2.png) [@vincent.fr](https://forum.mautic.org/u/vincent.fr)\
**Post date:** [November 11, 2022, 10:54pm UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041/25 "2022-11-11T22:54:07Z")

</div>

sure. I’m sending you now.

but it was working fine before I used this command `sudo rm -rf var/cache/*` . Plus I have another instance running on another virtual machine using the same configuration.

---

<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:** [November 11, 2022, 11:14pm UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041/26 "2022-11-11T23:14:57Z")

</div>

What if you try to replace entire var folder from repo here (everything under var - of course you first backup existing folder on the server):

> **[mautic/var at 4.4.4 · mautic/mautic](https://github.com/mautic/mautic/tree/4.4.4/var)**
>
> 4.4.4/var

Since you said it worked before. I would also backup entire source directory (mautic) and try to clone appropriate version from GH (you will have to copy app/config/local.php from previous folder to make app aware of already installed database etc.).

---

<div class="post-metadata">

**Author:** ![vincent.fr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/vincent.fr/32/6600_2.png) [@vincent.fr](https://forum.mautic.org/u/vincent.fr)\
**Post date:** [November 11, 2022, 11:37pm UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041/27 "2022-11-11T23:37:17Z")

</div>

I downloaded var from github, replaced the current var directory with the download, changed permissons, owner and group. still not working.

for the 2nd suggestion, I understand this to be a new install, right? It is like replacement of the entire directory, just keep the local.php. I’ll do it tomorrow, but I’m pretty sure it will work (I could install mautic from scratch some times).

My lesson for now is to never clear the cache that way again 😃

Thank you all.

---

<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:** [November 11, 2022, 11:41pm UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041/28 "2022-11-11T23:41:09Z")

</div>

Yes, but if you just replace source and put local.php in its place you do not need to reinstall mautic.

You might also need to replace media folder.

---

<div class="post-metadata">

**Author:** ![vincent.fr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/vincent.fr/32/6600_2.png) [@vincent.fr](https://forum.mautic.org/u/vincent.fr)\
**Post date:** [November 12, 2022, 8:00pm UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041/29 "2022-11-12T20:00:43Z")

</div>

I still don’t know what happened. But following @mzagmajster 's suggestion, I re-installed the instance.

This time I use composer [recommended-project](https://github.com/mautic/recommended-project), migrate the `local.php` file other directories to the new installation (more details [here](https://docs.mautic.org/en/setup/switch-to-composer)).

Remember to add `docroot` to the path in the `local.php`.

The composer seems to make installation and maintenance easier. It is really worth learning it.

It is working like a charm now. Thank you all for your replies, which allowed me to learn tons of things about mautic.

---

<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:** [November 14, 2022, 8:01am UTC](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041/30 "2022-11-14T08:01:27Z")

</div>

Closed on November 14, 2022, 8:01am UTC

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

[Previous page](https://forum.mautic.org/t/instance-broken-after-clearing-cache-the-wrong-way-reset-permissions-and-owner-does-not-help-yet/26041.md?page=1)
