Vhost caching issue

This article is over a year old and may contain outdated information.

While I was deploying the new website, I ran into some issues where CakePHP was blowing up on missing model database tables. The weirdness was that these models were not part of my application, but were part of another application running on the same nginx box. I immediately deduced that the problem was the cache, but where was the disconnect? Since the issue was related to model caching, it had to be part of the internal CakePHP caching mechanism.

The problem was a simple one, I forgot to change the $prefix (defaults to myapp_) cache variable in Config/core.php. A small oversight, but a problematic one at that. Just a reminder to everyone else that this variable does exist and to change it when running vhosts.

2 Comments

  • I ran into this issue as well, and it's also a bigger problem when running two versions of the same website on the same server.

    These days I just do this:

    $prefix = md5(APP);
  • I had this problem once too. I was coding a contest and it did lost more than 10% of all participation 'cause this miss config.
    I think cakephp must create an observation (security salt-like) to change this var.