1

Ok, basically I have a new homestead setup (0.1.9). I had numerous problems setting up the shared folder (because VirtualBox folder share is really slow). So my current setup is this: Homestead (0.1.9) nfs share (using winnfs from github).

The problem occurred when a view got cached (compiled) and didn't want to update. Every new addition to the file would show up, but if deleted, the view would get broken. I disabled nginx sendfile (thus eliminating weird cache issues when using nfs), opcache is disabled in the php.ini file (so no caching there), the homestead system time is like the hosts machine time (to avoid some confusion when the timestamp of the file is parsed, if it is even parsed). If I go to app/storage/views I can see the views are compiled, but they are free of errors only if they are compiled the first time.

So let's say I start with this file: http://laravel.io/bin/xmoQd. I load it in the browser and the compiled version gets added to app/storage/view. I add the lispum*15 and refresh again. Again the compiled version updates and everything is ok.

The problem is that when I remove the previous modification and refresh the page I get this in app/storage/view: http://laravel.io/bin/KX7eD. I have disabled nginx sendfile, opcache in php.ini, I'm using nfs (winnfs) to share the folder with homestead. I did php aristan cache:clear, did Cache::flush() in php artisan tinker, deleted everything from app/storage/views, did composer install again. Does anyone have a clue what's wrong. Thanks

Edit: I have tested some more, and confirmed that this is an error triggered by using NFS. Basically what happens is that Laravel serves the views during the compilation process and I get this strange output. When I reverted back to using the really slow VirtualBox folder share, everything is working as it should, but now the problem is that the page load time is really really slow.

Bogdan Habic
  • 94
  • 1
  • 8
  • Maybe a duplicate of : http://stackoverflow.com/questions/16971445/how-i-can-disable-templates-caching-in-development-mode/20688419#20688419 Note sure due to the NFS problem. The question is not enough concise for analysis. – Ifnot Mar 03 '16 at 08:25

1 Answers1

0

From time to time I have this problem, and, although this is not really a Laravel problem, but a operating system one, I hacked the Laravel View service to not cache views anymore:

Create a Blade Compiler overriding the isExpired method:

class BladeCompiler extends IlluminateBladeCompiler {

    public function isExpired($path)
    {
        if (Config::get('cache.views') === false)
        {
            return true;
        }

        return parent::isExpired($path);
    }

}

Create a Service Provider to override the compiler implementation:

class Provider extends ServiceProvider {

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $app = $this->app;

        $app->bindShared('blade.compiler', function($app)
        {
            $cache = $app['path.storage'].'/views';

            return new \My\BladeCompiler($app['files'], $cache);
        });
    }

}
Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204