System Details : Using WAMP2.5 in Windows 64 bit MYSQL:5.6.17 PHP:5.5.12 Apache :2.4.9I installed laravel via composer installation . It was all fine since recently all my views stopped showing any changes made to them . This is happening to views which use Blade template only.
I have created the blade files correctly and named them with filename.blade.php.
My view File Structure -
views
-layouts
defaults.blade.php
show.blade.php
login.blade.php
defaults.blade.php
<!DOCTYPE html>
<html>
<head></head>
<body>
<div>
<nav></nav>
#yield('content')
</div>
#yield('footerscripts')
</body>
</html>
show.blade.php
#extends('layouts.defaults')
#section('content')
--- SOME CONTENT ---
#stop
#section('footerscripts')
--- js scripts ---
#stop
The same format was working perfectly but suddenly started acting strangely.Even after refreshing many times the view doesn't change,Once i tried deleting everything inside the view page still it showed up in the browser.
There are similar question but many didn't have accepted answer and the one with some ratings didn't worked for me . I also tried re-installing fresh new WAMP copy but no Help.It only works if i change its name but if i change it back to the original one it again starts showing the old version of it.
Only happens with blade templating.
If you use PhpStorm:
open menu File → Settings
go to Deployment → Options section
then uncheck Preserve files timestamps option
I'm not sure of the specifics, but this is related to how filemtime() is implemented in windows (possibly related bug here).
Illuminate\View\Compilers\BladeCompiler (well, it's parent class, Compiler) checks to see if a file has changed since last compilation by checking it's mtime, through Illuminate\Filesystem\Filesystem which calls calls filemtime() (see L179-188). Evidently this is failing to report properly on your system.
First, ensure that the app/storage/views directory has read, write and delete permissions. If this doesn't help, the simplest solution would be to clear the app/storage/views/ directory whenever making a change.
I had this same issue , reason was I am doing uploads remote, but the time on my computer was different than what that was on my server
I got very easy solution, I was having same project in two folders, I was editing one and php artisan was running on other, when get to that project where php server was running in it and made changes it worked.
In your cmd(command prompt) or terminal type and press enter...
php artisan view:clear
For this to work, your terminal should be pointed to your root directory of your laravel installation/folder
Or delete files in the folder
storage/framework/views
In order to avoid the parsing of Blade files on each reload, Laravel is designed to caches views after Blade is parsed, to avoid re-parsing the blades on each reload.
Or make sure you are editing the right view, in the right Laravel Installation.
Run the command npm run production or npm run dev
It solved my problem:
I had the same issue except my controller methods also did not want to reflect changes along with views. I tried the following commands:
user:/var/www/html/website$ php artisan cache:clear
Application cache cleared!
user:/var/www/html/website$ php artisan config:clear
Configuration cache cleared!
user:/var/www/html/website$ php artisan route:clear
Route cache cleared!
user:/var/www/html/website$ php artisan view:clear
Compiled views cleared!
Nothing changed.
I echoed an incorrect variable from a controller method. Nada!
I changed the app.css?v=2 file version. In the silence that followed after... there was no difference.
I cleared my browser cache.
I manually deleted:
bootstrap/cache/config.php
framework/sessions/*
framework/views/*
No changes and finally I ran the command npm run production and bingo! Try it, it will save you 2 and a half hours of frustration and radical thoughts.
Laravel/framework v5.6
Clear cache and restart php-fpm. That solved it for me.
Related
I have a Laravel 5.3 project which was created 5 months ago, today I made a duplicate from the project and I made some changes into the code.
When I edit the views in a blade.php file my project which I edited showed me the last project view, I made a new route in the new laravel project and in the routes works well, but still shows the last project view.
It's funny because the js files works pretty well, but the view doens't work. for example, I edit the profile.blade.php file and it shows the content from the last project, if I writte something new in the other view from the last project, it shows in the new project.
Any ideas?
Thanks in advance.
Your views/routes are compiled/cached.
The storage directory contains your compiled Blade templates, file
based sessions, file caches, and other files generated by the
framework.
The bootstrap directory contains files that bootstrap the framework
and configure autoloading. This directory also houses a cache
directory which contains framework generated files for performance
optimization such as the route and services cache files.
Run these commands
php artisan view:clear - Clear all compiled view
php artisan optimize --force - Optimize the framework for better performance
php artisan config:cache - Create a cache file for faster configuration loading
php artisan route:cache - Create a route cache file for faster route registration
Disable opcache from php.ini or use:
ini_set('opcache.enable', 0);
How about, some time ago I had installed this utility to monitor the query results in my application, now I want to remove it, but I do not know how, someone knows how I can deactivate it?
Welcome to StackOverflow!
That bar at the bottom is called the Laravel Debugbar which is found here: https://github.com/barryvdh/laravel-debugbar
It is controlled by a setting in your .env file in the root of your project called APP_DEBUG. Set this to false to hide the bar (recommended for production).
To uninstall it from your project completely, run composer remove barryvdh/laravel-debugbar. Depending on your Laravel version, you may also have to remove the Service Provider from config/app.php (under providers) or remove it from app/Providers/AppServiceProvider.php depending how you originally installed it.
Note: If you're caching your config (by using php artisan config:cache) then don't forget to clear your config cache after changes by running php artisan config:clear.
I've SSH into the server and into the Laravel folder. I updated one of the html footer files but the changes aren't reflected on the website. I feel like I probably need to recompile something.
I tried deleting and re-creating the .env file (I backed it up first).
I've tried running the following commands:
php artisan clear-compiled
php artisan optimize
php artisan cache:clear
The only way I can seem to update the site is by updating the main.min.js file, located at /laravel/public/assets/js/main.min.js which is a terrible way to update the site.
How do I force Laravel to recreate this file or recompile the site based on changes I made to html template files within the site?
What am I missing here? I don't have any Laravel experience and am trying to update this site for a client.
edit:
I think I need to clarify a bit more...
The site appears to be rendered from this file: /public/assets/js/main.min.js
Most of the site's homepage, for example, is located in this js file. But the file is minified and therefore unwieldy to edit directly.
I am assuming (and I could be completely wrong here) that the file is generated from the html files located in the Laravel folder. To support this notion, I have found html files in other directories that correspond to the html located in the main.min.js file.
My assumption is that the previous developer would update the html files and then run something to compile the site into javascript files. But maybe this has nothing to do with Laravel, per se, and more to do with some frontend framework?
Try clearing the cached views...
php artisan view:clear
Laravel assets reside in
resources/assets/js
of your root directory you can have look their
if your file main.js is build using laravel mix have a on webpack.mix.js which compiles all your files you can get idea from that. make sure to run
npm run prod
if you change any file
Hope this helps?
i have been working on my project for several week. everything was fine. but today all of a sudden i can not load some of my changed views (some i can change and get result). even if i change the controller, its still now working. according to SO and some other site i have tried followings
restart browser
clear browser cache, history(even tried new browser)
php artisan cache:clear
php artisan view:clear
composer dumpautoload
delete all files from storage/framework/views folder
delete all files from storage/framework/sessions folder
restart nginx server
what did i miss. thanks in advance.
Run php artisan view:clear command to clear views cache. If this won't help, delete all php files in storage/framework/views directory.
Another thing you should do is to check if you're calling the view you want. It happens in big projects with a similar views. Use Laravel Debugbar to display actually loaded views.
I am developing a Laravel(5.2.29) project in Windows environment and testing it on Chrome browser.
I have made some changes on a Blade file using atom text editor and then refreshed my page and noticed that suddenly it has stopped reflecting the changes (it's loading the old Blade file).
I've tried the following:
Restarted the browser
Clearing browser cache
Running php artisan cache:clear
Running composer dumpautoload
Deleting the Blade file (and got a view not found error). Then created a new Blade file with the same name, with no content and refreshed the page.
No matter what, the code displayed on the browser is always the same (old) version and not the content of the Blade file.
How can I solve this issue?
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.
Run this command from terminal
php artisan view:clear
If you use PhpStorm, uncheck Preserve files timestamps deployment option:
https://stackoverflow.com/a/42534996/2453148
php artisan cache:clear
php artisan route:cache
php artisan config:clear
php artisan view:clear
rm -rf bootstrap/cache/*/*
Delete Cache/OPcache from PHP (fpm) of your Nginx/Apache server.
Clear the cache and clear the cached blade files:
php artisan cache:clear
php artisan config:clear
php artisan view:clear
You can also check if opcache enabled, in that case you need to clear your opcache cache.
Like Can Gelis mentionned in a comment. For me the solution was to reload PHP FPM
service php7.2-fpm reload
Alternatively if other suggested methods did not work, you can rename your files to different names. Refresh their corresponding web pages to start using new file name reference. Then you can rename the files back to your preferred names after the new pages to reflect their changes.
I have cleared all cashs and uploaded folders but didnt see changes.
Thus, if you have placed the project on a public hosting and don't have access to console then try to set deployment via your IDE (mine is phpstorm, e.g.)and set it to autoload mode. Then you'll get it working by changing something in the problem blade and by pressing cntrl+s(save) shortcut.
clear cache didn't work for me, but I just edited the file and saved it again, and it works!
None of these solutions have resolved this issue for me. Tried all php artisan options and the php code is not updating.
Only solution i've found is restarting the docker container that the code is running inside.
In case you try everything and nothing works. I recommend that you simply create a view under another name and the problem will be fixed
Example:
welcome.blade.php
change to
newview.blade.php
copy and paste code to new view
In controller just point to new view:
return view('newview');