Development phase: php keeps displaying images that have been deleted - php

I am in the development phase of my project. I am using WAMP, Dreamweaver, and IE9. Recently I changed the color of one of the image in my source folder. The problem is that when calling a php page via WAMP the image displayed is the old one (which does not exist anymore(?)) not the new one. It only happens with php pages. It works fine with html pages.
So I believe the problem is not coming from Dreamweaver or IE9. It comes from WAMP. Looks like my old image is saved somewhere (but where?) and for some strange reasons WAMP is loading it instead of the new image.
Has anyone of you met this problem before? How to solve that? Thanks.

Websites will store images in cache once it has loaded it from your website. This is to avoid redownloading a file that hasn't changed. Sometimes, however, the files have changed and the browser is still serving the cached version. There are a few ways to get rid of this.
Clear your cache
Set you browser to not cache images
Some browsers will offer "private browsing". Not only will this not store things like cookies and history, but it will also not cache images. At least, it will only cache them until the private browsing window is closed.
Add a querystring to any file you want to serve with a timestamp like <link href="styles.css?version=213948183214 />. This is typically for development purposes, though. You wouldn't want to do this in production unless it is essential.
Some browsers offer a "hard-refresh" like Chrome and Firefox. If you hold shift while reloading, it will refresh all served files with a fresh version.
Open the page in a new browser

Related

php files downloaded instead of parsing, issue resolved from server, old users keep downloading even now

Explanation : some php handler issue occurred at server-side, which made all of my php file getting downloaded from server on 8-10 of my domains (hosted on same hosting) instead of parsing and displaying.
Server people claim that they have corrected, if i visit the sites now from my regular PC & browser the url is still giving me files to download. if from anyother PC or Browser its parsing the page and not downloading.
It 99% seems cached content issue after their efforts.
Problem : All of my OLD-regular users are now getting the files download rather parse. I cannot contact every user to clear their browser cache (if it is cache issue).
What can i do to resolve issue as a webmaster and make all my users get files parsed rather download.

Laravel 5 on Shared Host Problems

I am trying to deploy my website with laravel on web shared host, not vps.
I have 2 problems here:
When I overwrite picture in public folder, the picture won't changed. But if i checked on file manager on cpanel, it actually changed, and when I copy the image address and paste it on other tabs it doesn't changed until I refresh it, the image changed so do in the web. I'm using Laravel Image Intervention to uploading image, i guess it's don't have problem with library.
For this problem, I just write
Image::make($imgDriver->getRealPath())->save($pathDriver); to upload the images. I've tried to use File::delete before overwriting the image, but it doesn't solve the problem.
The second error is, sometimes i stucked on redirect loop, and I don't know why, all I do was clearing cache to fix it. Do i really need to clean the cache everytime it shows redirect loop. Any other way to solve it?
I'm using Route::controller to route. Is it the problem?
I really appreciate any help. Thank you
Your browser is likely caching the image, rather than your hosting provider. If you use Google Chrome, there is a setting to disable cache, which is handy for development. If you want the image to update in your code, append the timestamp to the end of the image in your HTML, e.g. <img src="my_image.jpg?ts=12345">. If you use the timestamp when the image was uploaded, it will change everything a new image is uploaded, effectively loading the new version without clearing cache.
The redirect look is likely to be a session issue, where you're saving or updating something in the session, causing a redirect loop to occur. This can be painful to debug, but the best thing to do is add debug code to the affected routes / functions to narrow down the cause, e.g. using dd("i'm here") to see which block of code could be responsible.

Laravel development on remote server experiences CSS/JavaScript change delays

I develop on a remote server. I'm not sure if this is a laravel caching tendancy, but CSS and JavaScript changes tend to be delayed longer than usual. I can make instant HTML and php changes, but sometimes it takes more than a few minutes for CSS and JavaScript changes to be reflected on a page. I do know that .blade.php files are generated and cached within an app/storage/views folder, but even when I delete those the changes are not reflected right away.
I have tried on Chrome and Firefox.
Any ideas? Thanks!
CSS and Javascript are not handled by Laravel.
You can check it from the .htaccess of the public folder
Most likely you are hitting the cache browser. One solution to avoid browser cache is to append to the css or javascript a unique identifier whenever there is a new release, e.g.:
site/my/css.css?12345
^
|
+ - Change this to force a fresh copy
What ended up working best was to clear the cached views on the server, as #dynamic hinted at (Laravel and Blade store these cached files).
AS WELL, to close the tab completely and re-access the webpage fresh. There were cases where it was still cached, and so I would just switch to another browser.

wamp html script not updating

I am trying to run a php based web app locally using wamp. On making changes to the html script in .php file, the page does not get updated. However, changes in css files are being updated. Any fixes to the issue?
If your code changes dont get reflected when you view the page, it has probably been cached by the browser.
Always use CTRL + F5 so the cache is refreshed when making changes.
Alternatively most browsers have developer extension and one of those is usually an option to turn off caching. You should look for that and set it while developing a site.
How do I Disable FireFox's Browser Cache COMPLETELY?
How to disable caching in Internet Explorer 9?
Disabling Chrome cache for website development
If you disable both of these lines in the php.ini file, this should no longer happen.
soap.wsdl_cache_enabled=0
opcache.enable=0
At least that worked for me.
Hope it helps.

Chrome will not display current image / really weird

Just 30 mins ago I ran into a really unexpected problem (which as a matter of fact happened to me for the 1st time in my life, and in the 10 years of coding websites).
On a particular page from my admin module, few images reverted to their old state, the exact way they were few days ago. Which means I changed them yesterday, and now they all look like they were before.
It gets more weird. I logged in with Filezilla, and deleted the images. They still appear, with the way they looked 3 days ago, before I changed them.
If I go to the URL of the image it still displays the old images. If I look locally in my Windows folder they are the new version, upload them again, still the browser displays the old version.
I erased the cache in Chrome, even restarted the computer thinking there is something to do with Chrome or something, i really ran out of options. Firefox displays the same, the old images (even if i uploaded the new version of images).
I tried with CPanel FTP manager and...surprise...if i look at an image, it's the good version of images (the new one!). But all browsers fail to see the image.
Also as a keypoint, if I erase the image with ftp, the browser still sees it (SHIFT + f5, still it sees it, so it's not from cache). ?!?!
ANy pointing to the problem is really appreciate. Cheers
Sounds like your hosting provider has a reverse proxy that caches requests for images. One way to overcome the problem is to add something to the URL, perhaps a request parameter, that makes the proxy think that the request is not for the same image.
For example, http://www.example.com/yourimage.png?date=2012-10-25
Sounds like the hosting provider is screwing you over, so I'd say step one is to dump them and move elsewhere...
But if Joni's suggestion doesn't work, you can build your image dynamically on the server, like:
<img src="imageHandler.php?image=myimage.png" />
Your imageHandler.php code would need to read the bytes of the image, and build the HTTP response manually and pass the image bytes back. Not sure what that would look like in PHP, but it shouldn't be more than a few lines of code.
This is a terrible solution, since it would require a ton of processing and disk access for a trivial task like pulling images, but I'd expect that it would at least work.
it's the first time i answer my own question cause it was related to external factors.
yes, problem was fixed, it was actually the guys at tech. dept. at the ISP i have the files hosted, the virtual hosts config file for my domain xxx.net was ..misconfigured.
cheers all, problem is fixed

Categories