Unable to write in the cache directory /var/www/html/tmp/templates_c/7b while trying to login into matomo from admin user

I am on matomo version:4.14.2 and while I was logging into my admin user I was getting this error:

Unable to write in the cache directory /var/www/html/tmp/templates_c/7b while trying to login into matomo from admin user

So after that I get inside the mentioned path and i checked there user it was showing root for some of the folders inside template_c. After that I applied
chown -R www-data:www-data/var/www/html/tmp/templates_c/7b

It started working fine for me But I am not sure why this happened because the owner for /var/www/html/tmp/ is www-data and all the other folders in the path /var/www/html/tmp/ have user www-data.
It would be a great help If you can help me on this.

Hi @Aditya_Raj

Same issue here… I have some folders with root as owner and some others with the server user. The installation was running by itself, without any changes made before the error. Now I can’t log in.

Hello sdesergi.

  1. I trust you were able to use the chown command, as did Aditya. That usually fixes it.

  2. As far as Aditya Raj question, “what causes this?”, I can confirm that this error happened to me immediately after I ran several php ./console commands as root. Three cache directories got owner changed to root. The error went away after I ran chown (see above)

1 Like