Support the ongoing development of Laravel.io →
posted 10 years ago
Cache
Last updated 2 years ago.
0

Did you ever solve this? This happens to me from time to time, and I haven't been able to isolate the cause. I'm also using NFS, and sendfile is off.

Last updated 2 years ago.
0

I'm having this issue as well. And it's more than a few seconds - sometimes it takes up to 30s to show the changes.

Last updated 2 years ago.
0

whats the solution?? for this problem. I change css or js or html and just old version its render.. waiting

0

Same here guys, did anyone find the solution?

0

Never found the solution... Still getting the problem in Laravel 5.

0

I'm experiencing this too

0

Same problem here, also with another vagrant box running nfs, Apache and sendfile off.

Even compiled blade templates are cached, no matter how repeatedly fast I press F5 or cmd+R :P

I can understand css, js and other assets still cached sometimes, but blade templates? Sounds strange.

I'm not sure if is a Laravel issue or nginx issue, or apache issue, or nfs issue, or black magic?

The fact is that without NFS everything works (despite the slow responses).

0

I was having the same problem and it turned out to be because of 2 things:

    1. opcache.revalidate_freq
    1. The guest machine's date needed to be behind the host

To fix it, first find the location of opcache.so:

$ sudo find / -name 'opcache.so'
/usr/lib/php5/20131226/opcache.so`

Add that location to opcache.ini and ensure the file has revalidate_freq set to 0 (I use nano, but you can use vim or whatever editor you want):

$ sudo nano /etc/php5/mods-available/opcache.ini

zend_extension=/usr/lib/php5/20131226/opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=0
opcache.validate_timestamps=on
opcache.fast_shutdown=1

And to fix the date issue:

Update the timezone:

$ sudo dpkg-reconfigure tzdata

Update the time so it's older than the host OS. For example, if your Host OS is at 11:02:15, then set your VM to:

$ sudo date --set 11:01:00
$ sudo service nginx restart

You'll need to reset the date each time you vagrant up the box, but this finally fixed the problems for me.

Note: Don't forget to update /etc/nginx/nginx.conf to have sendfile off;

Note: And don't run your dev site on HHVM when developing (use the serve.sh script to turn your site off of HHVM if it was setup that way):

 $ cd /etc/nginx/sites-enabled
 $ sudo rm your-hhvm-site.app
 
 $ cd /etc/nginx/sites-available
 $ sudo rm your-hhvm-site.app
 
 $ sudo service nginx restart

 $ cd /vagrant/scripts
 $ sudo sh serve.sh your-site.app /home/vagrant/whatever/laravel/public 80
 $ sudo service nginx restart

(use serve-hhvm.sh script with the same directions above to turn your site back on to HHVM later if you want)

Note: Also for local/dev environments, you can update your .env file to cache using array like so:

 APP_ENV=local
 APP_DEBUG=true
 ...
 CACHE_DRIVER=array
 SESSION_DRIVER=array
 ...

In Laravel, you can run php artisan clear-compiled (the opposite of optimize) to clear vendor/compiled.php and other things.

Last updated 9 years ago.
0

@prograhammer

I had to login just to thank you!

0

@prograhammer, you're a genius!

I must ask, how did you figure it out? I googled for weeks to no avail...

Last updated 9 years ago.
0

Just, wow. Thanks prograhammer, it works!

NFS mode has drastically sped up my workflow, but this issue (seemingly random as it is) was becoming enough to make me switch back.

EDIT: Well, I might have spoken too soon. The issue seems to happen less often, but it definitely still happens.

Last updated 9 years ago.
0

gbrock,

Are you on HHVM? If so, don't run your dev site on HHVM. What about your .env cache settings? See my edited previous answer above.

If you are on Windows, I also have a GIST I'm maintaining (and I will also update its read-ability) that has solutions in detail and you can "star" it to keep them handy next time you need to get a new Homestead box up and running. Here's the Gist link below:

https://gist.github.com/prograhammer/9493ee04f30dd74e121b

Last updated 9 years ago.
0

Nope, HHVM isn't on. Thanks for the gist; if I'm on OSX is there much there that can help me?

0

gbrock,

Hmmm...

There are issues with winnsfd on Windows (which I'm updating on my Gist today with link to fix), but since you are on OSX, you should be good to go now with that opcache fix and server time fix from earlier post above.

Is it your views that aren't updating? Or php class files? Remember, if you vagrant halt and vagrant up again you'll need to fix your server time again. Also, you updated your .env file to use arrays, right? And do a:

 php artisan clear-compiled
Last updated 9 years ago.
0

Had to login to say thanks to @prograhammer

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.