Updated Image file but not reflecting on Live server in laravel 9 - laravel

I'm new with Laravel and I made web application but when I updated the image file or some css code it will not reflecting on live server.
I tried:
Route::get('/check',function(){ Artisan::call('cache:clear'); Artisan::call('optimize:clear'); Cache::flush(); });
but this is not working.
I just want to reflecting updated image file or css file when I update it.

"it will not reflecting on live server"
This is the bit that worries me being you've tried the cache clear commands. Laravel will mostly serve up the current assets, there are of course exceptions!
Laravel octane; If you're using this package then php artisan octane:reload
Other sources for these sorts of errors to check first would be
Browser cache - try renaming the files or adding a query string to their lings.
CDN cache - lots of people use cloudflare as a CDN and DNS, make sure development mode is turned on and you've flushed the cache there.
For the most part, just adding a query string and/or changing the name should be enough to prompt a fresh download.

Related

Server caches files

I've installed my laravel project on shared hosting. Everything was fine until when server starts loading old pages and scripts after uploading changes.
I've checked and cleared browser and laravel caches every time but the problem still. Then I've deleted laravel files but the server still loads main page while it should loads main directory content.
Now after installing laravel again the server loads the directory content for main url and works fine for other laravel routs.
The most confusing issue is the when trying to refresh browser several times, it loads the actual pages for one or two times then it back to load old cached files.
That was because of cloudfare caching.So I've to develop locally then upload the final release to remote server
Make sure that you are not using any caching services for page caching(actually page caching is a good feature), if yes please try invalidating the page cache.
If you are using Cloudflare, purge your cache. you can purge the cache of objects or full objects.

Updating a hosted 5.3 laravel web site in BLUEHOST

I'am currently working on a hosted web site which was developed with Laravel 5.3 in Bluehost . So for futher developments I have folled below procedure.
Compressed the folder and downloaded it in to local machine.
Created a public folder and moved relevant folders into it.
Via php artisan serve develpment started and everything went fine.
After the development only 4 files to be changed in the server. So I have opened the related files in server and updated the coding by just copy and paste.
When I refresh the web url after updating files I can see that php
and html updated correctly but css and javascript was not
updated. So I checked the files again but they are almost updated. But
when I view the source I can see that both css and javascript
files have not updated.
So I just created new files in the server with different names and linked them into the blade.php files and then css and javascript working fine .Also when I view the source they are also updated.
Can anyone say what is the reason for this?
This happens due to caching most of the time.
If you are using Cloudflare as a service purge the cache and give it a try.
Steps to purge your domain cache due to Cloudflare
STEP 01
Login to your Cloudflare account and select the domain you want to purge the cache.
STEP 02
Go to the caching tab.
STEP 03
In there, there are two options you can select. one is, you can purge the cache on selected file by simply given the URL of the file you want to purge the cache.
the second one is you can purge all cache in Cloudflare server under your domain by clicking purge everything button.

Xampp doesn't reload changes when files get updated

When I copy live opencart website to the local xampp, can't show any updates
I had a working local copy on my localhost, but I needed to get the most updated copy from the live site. So I copied the live site and the live db(in workbench). Then I changed config files(both admin and catalog). The website works perfectly on local browser, but the changes I do through code doesn't show on browser. But when I change my database to the old local db I can see updates.
No errors showing on browser
Thanks
"As a developer, or store owner, you may make a change somewhere in your online shop and not see that change being applied on the front-end. In that case you probably need to clear your caches, but there is more than one so it helps to be aware of what caches there are and how to clear them."
https://www.antropy.co.uk/blog/how-to-clear-all-caches-in-opencart-3-0-2-0/
I've solved the above issue using Twig/SASS (Template) clear cache method. I have to do this for each update. But then I got another issue - the default image on product category doesn't show up. Image src shows as unknown, which fetch from cache folder. Any solution for this please?

Browser is rendering page based on old php source code despite uploading new ones (Cpanel)

The project is based on laravel and uploaded in cpanel. When I view the file from file manager it shows new source code, but browser is rendering pages based on old ones that I already deleted. Not the case with every page however, some are showing new updates.
I have tried uploading after clearing laravel cache and server apcu and opcache cache.
I think it's a caching problem, try deleting files in storage\framework\views\ directory.

Laravel FileZilla upload/download

Is there a proper explanation as to why when I'm either pulling the complete project from the server, or pushing it on server, views don't get updated? I always have to manually go to the resources folder and transfer views after everything has already uploaded/downloaded.
The solution is to clear your cache like stated in the comments.
php artisan view:clear
The reason why this is happening is because by default the caching is set to File. Which means that the view-cache is stored in files. When you upload everything the old-cache is uploaded. The files are stored in storage\framework\views
If you upload a single folder, laravel notices a change and the cache is busted.
PS: it is recommended that you use git for this kind of stuff, Laravel has .gitignore files to prevent this kind of behavior.

Resources