 <p>Solved!</p> <p>So problem was that I had Drupal migrate module and it was configured to use second database (Drupal 6, from old site) on my VM only. On staging that second DB configurations was also wrong, but for some reason (I guess different PHP settings) it was not shooting that error. On live it was.</p> <p>And what I didn't know is that Drupal migrate module is connecting that second DB even if it's not used directly, i.e. when cache is cleared - have no idea why.</p>