Laravel and view caching in development -- can't see changes right away
The #laravel IRC channel is a God send. This had nothing to do with Laravel's behavior at all. This was actually something PHP 5.5 was doing.
The reason this was so baffling is because I upgraded my PHP version from 5.3 and never had this issue.
In your .ini file, you need to tweak your OPcache settings. For me, these settings began at line 1087 in the .ini file and looked something like this:
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
Take particular note of the opcache.revalidate_freq=60
. This is what is actually making your views cache. If this is not the desired behavior, set the value to 0
and your views will update every time you make a change. Yay!
EDIT AUGUST 21, 2014
As mentioned by Matt below, make sure to restart your web server to see your changes take effect after you have changed your .ini file.
Laravel 5 view caching
If you don't have a shell access to run artisan commands you can create a dummy route to do that. (Feels like a dirty solution :) )
Route::get('/clearViews', function () {
Artisan::call('view:clear', []);
//
});
Blade view not reflecting changes
In order to avoid the parsing of Blade files on each reload, Laravel caches the views after Blade is processed. I've experienced some situations where the source (view file) is updated but the cache file is not "reloaded". In these cases, all you need to do is to delete the cached views and reload the page.
The cached view files are stored in storage/framework/views
.
Getting frustrated with Laravel 5 blades
Are you sure it's not just cached? Try this: go to your \storage\framework\views
and delete everything except .gitignore
file, and try again.
If laravel is caching your view, clearing the browser cache won't help you as the caching is done server-side.
If you are actually using laravel 5.1, you can type on your terminal php artisan view:clear
More info: laravel.com/docs/5.0/cache
local Laravel web page takes several minutes to update
In case anyone else has the same problem, I fixed this by disabling caching in my php.ini file and restarting my server (see this post) why this became an issue out of the blue after several weeks, I have no idea.
Related Topics
Curl Requires Curlopt_Ssl_Verifypeer=False
How to Search Through a JSON Array in PHP
How to Send Cookies with File_Get_Contents
Php: Check Who Had Read Sent Email
Warning: "Continue" Targeting Switch Is Equivalent to "Break". Did You Mean to Use "Continue 2"
PHP Date Time Current Time Add Minutes
How to Connect PHP with Microsoft Access Database
How to Write to Error Log File in PHP
How to Check for a Specific Type of Object in PHP
PHP MySQL - Insert New Record into Table with Auto-Increment on Primary Key
Convert to Date Format Dd/Mm/Yyyy
Try Catch Cannot Work with Require_Once in PHP
Soapfault Exception: Could Not Connect to Host
Difference Between File, File_Get_Contents, and Fopen in PHP