I am developing a simple php website using LAMP stack. Lot of the times, when I edit a javascript file, the new file with edits do not show up in chrome's debugger or in firebug. In the same way, when I edited a css file, the old css file gets loaded. I even renamed the old css file, still the old file gets loaded. Is it being cached somewhere? I even tried restarting the server.
Hold shift and click reload to force Chrome to load all files from the server.
ctrl + F5 is the shortcut for clearing cached files on the given page
Related
So I'm building a web application using HTMl CSS and PHP, and sometimes when I make changes to the css file, the web doesn't react to it and I can even delete the whole file and still doesn't change a thing in the browser and I have to copy everything from the css file into a different css file and use that one and after that it works but it often takes only a few minutes and i have to change it back so currently i have style.css and styles.css and depending on the situation i use either the first one or the other one but its annoying, I think it could be something with the server I'm running it on localhost using XAMPP. Thanks for any suggestions.
It is because of the browser's cache.
If you are using Windows or Linux, just go on the browser and hit ctrl+f5 to clear the cache.
You can also click on google chrome's settings, then search for Cookies and site data and tap Clear data.
Or open Chrome's developer tools by pressing F12 then open the Settings (F1). Find the checkbox labeled Disable cache (while DevTools is open) under the Network heading and turn it on so Chrome will no longer cache your CSS files and always load the latest version when the dev tools window is opened.
Your problem come from browser cache.
It's not only happened to CSS file, but to script as well.
There are many solutions for this:
If it's occur to production environment:
You can versioning your script and stylesheet file
If it's just about developing in local environment:
You can empty cache and hard reload the webpage (by opening devtool, right click in reload icon, select empty cache and hard reload or just simply use ctrl + f5). This will need to be done every time you have a change in script or stylesheet file
Or you can disable browser cache (open devtool by pressing f12, switch to network tab in browser devtool, and check Disable cache.
I'm not recommend Disable cache. You should stick with empty cache and hard reload
could you help me to troubleshoot why I suddenly can’t render PHP files in my browser or the preview pane of my text editor (Panic Coda) please?
I use a combination of PHP scripts and the Smarty templating engine to write html files for email newsletters. Up until midday today, when I use the Coda preview to run the PHP scripts, the layout renders fine and the html file writing included in the script also worked.
But then suddenly, when I preview the file, all I see is the PHP script in the preview pane – see screen shot.
This happens occasionally, but it is usually enough to quit the application and start it up again, or restart the computer. But not this time.
Apache is on? Check.
Updated to macOS Sierra? Not yet.
No other substantial systems changes? Not that I can think of. Certainly none in the last few hours.
It was this:
Make sure you are accessing your file over your webserver using an URL like http://localhost/file.php not via local file access file://localhost/www/file.php
found here: PHP code is not being executed, instead code shows on the page
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.
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.
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