Intermittent error "File does not exist: /var/www/html/var" from all areas of a Zend MVC app resulting in pages occasionally failing to load - when normally they load perfectly.

Our Set-up
MVC app on a LAMP stack on AWS with:

  • Zend 1 front end app on a medium c1 AWS linux AMI 64bit instance
  • MySQL database on a medium m1 AWS linux AMI 64bit instance
  • running phpbb3 forum in parallel with MVC app on app server, with 2 x databases on the db server (one for app, one for phpbb)
  • php 5.4.22
  • mysql 5.1.72 + mysqli
  • elastic IP addresses associated to both the app and database servers
  • app & db servers are connected using private IP (ie app server connects to db server private ip, db server security group accepts the app server private iP on port 3306)
  • currently running the site as a dev site, using a dev directory off the main site eg:


  • in /dev/configs/application.ini we define the following:

    setting.basedir = dev   
    setting.baseurl = http://www.mysite.com/dev   
    setting.securebaseurl = http://www.mysite.com/dev  
  • have our DNS with godaddy, and are using A host = IP address (ie IP.IP.IP.IP) not cname

  • are not using virtual hosts (since we only have one site per 'server')
  • we have htaccess files & various redirects throughout - but have no errors on our local LAMP servers
  • we are using minify and have the RewriteBase commented out (per default)
  • httpd.conf settings are mostly default (let me know if there are important ones that aren't listed here)

    ServerName www.mysite.com
    UseCanonicalName Off
    DocumentRoot "/var/www/html"  
    <Directory />  
     Options FollowSymLinks  
     AllowOverride ALL  
    <Directory "/var/www/html">  
     Options Indexes FollowSymLinks
     AllowOverride All
     Order allow,deny
     Allow from all

The Problem
We're getting the following intermittent error in /etc/httpd/logs/error_log :

File does not exist: /var/www/html/var, referer: http://www.mysite.com/dev/various

When this error happens, a half complete page of whichever part of the site we were trying to access is displayed with the message:

"Failed saving metadata to metadataCache"

Error is intermittent in that we can't repeat it with any sequence of actions or timing:

  • repeated page refresh seems to get rid of the issue, the page will eventually be displayed correctly and the rest of the site can be accessed normally for long periods
  • it is independent of browser or IP address (used to access the site)
  • it seems independent of the page we try to access (ie we've had errors from all site pages)
  • error seems to resurface after leaving the site idle for periods and then accessing a new part of the site - although this is inconsistent (sometimes the error reappears halfway through using the site actively).

We do not have this problem on local machines - we have about 3 different local machines on mac lamp stacks & windows machines with our developers.

We did not have the problem on the original AWS configuration which was app + database on a single linux ami micro instance - accessed via ec2 addres & configs/application.ini baseurl set to ec2 address (ie we were not using DNS A host settings at that stage)

Theories and things we've tried:

  1. When we update the application.ini settings to use IP rather than DN we don't seem to get the error (which would indicate a server root / dns loop of some sort)

    setting.basedir = dev   
    setting.baseurl = http://www.IP.IP.IP.IP.com/dev   
    setting.securebaseurl = http://www.IP.IP.IP.IP.com/dev 
  2. Initially we thought it could be that in httpd.conf ServerName was commented out, but when we set that to www.mysite.com, mysite.com or "www.mysite.com" it makes no difference

  3. We have done the usual steps of deleting all Zend + forum + browser cache, restarting Apache, restarting MySQL etc

Nothing we do seems to indicate where the source of the error is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.