Moving matomo to a different domain on the same hosted server - failed

I was running matomo on my old joomla directory - this was also a different sub domain (www.old.berndjung.com) as my website (www.berndjung.com).

Everything is happening on the same hosted server!

As this is causing another SSL Handshake and DNS lookup (takes sometimes 0.6 seconds) i wanted to move matomo to the same directory and same domain to speed things up for my visitors and pagespeed.

So I installed the same matomo version in the web directory of berndjung.com. In the installation process i pointed to the same (old) MYSQL Database.

I added www.berndjung.com as trusted host. i changed the tracking code in the joomla plugin to track …

But it is not working.
I can log in matomo - but i get error messages …

“Oops… there was a problem during the request. Maybe the server had a temporary issue, or maybe you requested a report with too much data…”

when trying to make system check in settings i get

" Mysqli prepare error: MySQL server has gone away"

Visits in real time are shown …

No problems when trying to reach the (same) database from the old installation though …

config.ini.php

; <?php exit; ?> DO NOT REMOVE THIS LINE
; file automatically generated or modified by Matomo; you can manually override the default values in global.ini.php by redefining them in this file.
[database]
host = “localhost”
username = “xxxx”
password = “xxxx”
dbname = “xxx”
tables_prefix = “piwik_”
adapter = “MYSQLI”

[General]
salt = “xxx”
trusted_hosts[] = “www.berndjung.com

config.ini.php of the old installation shows different “salt”, no adapter settings, force SSL …

Any help and explanation is welcome.

Hi,

I’m not too sure if this is worth the move. If your DNS lookup takes up to 0.6s, this is something you should look into. At least for my website the SSL handshake, TCP connection and DNS resolution overhead of the Matomo subdomain is 31ms, 28ms and 8ms. Also they are all only on the first request and even if they took a long time it would not slow down your website as Matomo is only starting loading once the website can be interacted with by the user.

Subdomains have their advantages as they separate Cookies (which is good for security) and make sure .htaccess rules don’t affect other applications in subdirectories.


But that is besides your point. MySQL server has gone away can have many reasons as it is caused by the connection between PHP and MySQL.

See here for some tips:

Thanks for your answers.

Interesting point with keeping the subdomain für sec reasons and seperate Cookies.

GTmetrix shows 133ms for DNS, SSL Connecting and receiving matomo.js. What takes such a long time in GTmetrix (last check: 1.8sec) is
https://old.berndjung.com/xxx/matomo.php?action_name=Konzept%20%26%20Methoden&idsite=1&rec=1&r=849939&h=8&m=55&s=13&url=https%3A%2F%2Fwww.berndjung.com%2Fsystemisches-coaching%2Fcoaching-konzept&_id=e49345d82f2278f2&_idts=1604336113&_idvc=1&_idn=1&_refts=0&_viewts=1604336113&send_image=1&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=0&java=0&gears=0&ag=0&cookie=1&res=1367x863&gt_ms=153&pv_id=NnYllW

So - there was nothing wrong with my idea that i could use the same database?