0

This is a little bit tricky trouble.

I was setting up a new development environment, which includes the below:

vagrant 1.6.3
Apache/2.2.15 (Unix)
php 5.4.32
ZendFrameword2

The trouble I am running into is that I can't refresh the change of css file properly.

What I have tried is,

  1. put META tags for no-cache like

<meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache">

  1. force a browser to get the latest file by

<link rel="stylesheet" type="text/css" charset="utf-8" href="/path/to/css_file.css?<?php time() ?>" />

But I found out there is no difference with the above.

I found that I make it to refresh a css file with the following process

  1. remove the css file
  2. access from my browser and confirm it doesn't exit by showing error message.
  3. and remake the css file and access it.
  4. I get a refreshed file.

  5. Next, I google about Cashing Algorithm for ZendFramework2, and test loading with ZF2 files that may relate to caching control.

It resulted no ZF2 File is related when just to load css file.

Then I notice that if the css file is quite small, it properly refreshed. so I checked various condigions and I found out that I get this trouble when the file size is over 255B.

the rest of part I can inspect is, .htaccess or apache setting files on a server.

.htaccess file under the public directory of ZF2 is:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$ RewriteRule ^(.*) - [E=BASE:%1] RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
RewriteCond %{REQUEST_URI} ^/phpmyadmin/(.*)$ RewriteRule ^.*$ - [L]

Do you guess any causes? any advice?

gipinani
  • 14,038
  • 12
  • 56
  • 85

2 Answers2

0

I haven't solved this question yet, but I specified what is the problem actually.

The matter is,

What apache module is lacking when I can't write over 255byte in a file on document root?

so, I am closing this question for now.

0

Finally! I got the true problem and have solved it.

Additional Experiments after the first post are

1) I replicated the same situation with .js file, and .index

→ So I confirmed that it was not a trouble about css

2) I replaced simple htdocs directory with the one with ZF2 to simplify the situation and discovered that the phenomenon still happened.

→ ZF2 has nothing to do with this problem.

3) I suspected Apache settings next, so I stoped apache and installed and started nginx. Surprisingly for me, the trouble kept happening.

→ Apache settings / modules are not causing the problem.

4) directory errors on guest OS working on vagrant hit to my mind, and vagrant up again with a different synced folder

→ I got no difference.

5) I was finally sure that vagrant is somehow causing this problem, and found the true cause after a few minutes of search.

The solution for this problem is

to add

EnableSendfile off

for httpd.conf if you use apache, and

sendfile off;

for nginx

Related links are below:

Vagrant/VirtualBox/Apache2 Strange Cache Behaviour

https://coderwall.com/p/ztskha

http://abitwiser.wordpress.com/2011/02/24/virtualbox-hates-sendfile/

Community
  • 1
  • 1