XAMPP wont load my updated CSS files - php

I have my site on the localhost by using XAMPP. Every time I edit a file, I change its' extension to .html from .php to be able to edit it properly with WebStorm.
I noticed for some reason if I modify the css/scss while the folder on the server, the updated css will not be loaded. Why is that?
Now I have to edit everything from .php to .html and move folder out of XAMPP every time I have to edit CSS. And even if I then move again the file into the XAMPP folder, some of my css still wont work..?

3 solutions for this.
Use incognito mode in your browser.
When you refresh to see the css use control+f5 so you do
cache-refresh.
Remove cache from the developer console of your browser.
Pick which fits best for your (personally i use the second one)

You can also do a hard reload using Ctr+Shift+R and it will start to work again. thats what works for me or try hard refresh using ctrl+f5, but hard reload works best for me after I use that I can simple refresh and it works.

Related

PHP Liveserver, Visual Code, SASS can't work together

I'm quite new to coding in Visual Code, and been able to use LiveServer flawlessly with html.
But I decided to go with php for a project, so I made a server with XAMPP, downloaded chrome extension for Liveserver, but it doesn't work as it should:
If I add something (like a div) in e.g. index.php, Ctrl+S, the browser reloads, and shows the new div flawlessly.
On the other hand, if I change some styling, which I do through SASS (yes, "watching" is on"), LiveServer detects some change, reloads the page, but uses the same css as before. Checked with browser F12, it is DIFFERENT from the one saved in the original folder...
So basically no matter how I change css, browser doesn't reload the new one.
Can you help me to make it work?
Thank you!
Try to clear browser cache and check if there is some errors in the console (where you watching sass files)

PHP filepath messing html links

I have an issue migrating a site where the links are all broken. It's a html site but uses php file system. The links in the index.html has \ in front of it. There's a file of php files like: Configuration.php, FileSystem.php, Bootstrap.php, Handler.php. How do I revert to just regular hmtl links.
Thanks!
If all you want to do is convert the dynamic PHP based website to a static HTML is easy.
Open the website in Firefox (Chrome will probably work too, but I did not test).
Go to File->Save Page As... and select a directory on your PC.
Firefox will then download the main file and needed dependencies to the PC eliminating all the PHP since it doesn't even know the server generated the page dynamically using PHP.
You can now deploy the site where ever you like.
Please note that if there are JS files that actively communicate with the server to download content dynamically you'll have to edit them yourself.

Code changes in Netbeans not reflected in project

Often times while working in Netbeans the changes I make in my code are not visible in the actual project. I'm working on a website using HTML/PHP and a lot of times, I make certain changes to my code, save it and then when I open the website in my browser it's like I never made any changes. It's really frustrating. Please help.
PS: I've noticed it mostly happens when I make changes to the CSS file.
First I would think of blaming Netbeans. Or you for not letting Netbeans upload changes to the server on Save.
But if it is mostly CSS (and I suppose Javascript), I would think of caching by your browser.
You can try Ctrl-F5 -in your browser- for forced refresh.
Or set the cache settings on your development server so, that a file is never cached

MAMP + dreamweaver + delay issue

I am very very new at PHP programming.
I am making up some code to test my learning but I just discovered a very annoying problem.
I have no idea about the cause, so following I'll describe my situation and I'll leave to you the "honor" to find the problem :)
I use dreamweaver to write my PHP code.
Once I made all the changes, I save the file and refresh the browser page to see the result.
Well, here is the problem. For like 30seconds nothing changes, after this time delay the page actually refreshes. There seems to be a delay between when I save the modified file in dreamweaver and when the browser (Chrome in my case) sees the new file.
I tried different browsers and I also verified that the file is physically changed...I have no clue.
It has nothing to do with Dreamweaver.
You have to disable OPCache
Some software such as MAMP turns on OPCache by default in the php configuration file (php.ini), you can disable it this way
opcache.revalidate_freq=0

Linked (CSS) and scripts don't update content on my VM with a shared folder document root

I have made a clean install of Apache and PHP on my CentOS6 virtual machine, I have also created a shared folder and use it as my document root.
Everything works perfectly, I can access the website, do all the stuff I want to do and I can edit PHP files on my workstation and they will be immediately up to date when testing in a browser.
However, when editing CSS and JavaScript, files that are "linked" into the website, I run into an odd problem, when doing an uncached reload of the page they don't update the content, they do however update the content-length.
So if I've added anything to a script it will give me the same content, with a higher content-length and attempt to correct this by adding unknown character signs (the square question mark thing).
If I remove something the reverse happens, it recognizes that the content-length is shorter and starts removing things at the end.
This has happened on two clean installs and I've tried to Google for someone with the same problem but the diffuse nature of the problem makes it hard to define.
I've tried all Apache configurations possible for forcing un-cached results all without luck.
The only thing I've found to force it to update is a remount of the shared folder
If you need more information I'm happy to supply it!
While I was beginning to suspect that the problem was not in the cache, any other problems were slightly out of my reach as I've not worked much with virtualbox.
However, a colleague of mine noted that vboxsf "is less than good" (not in quite those words). So when I had something else to go on a search was easier to define and presto!
https://forums.virtualbox.org/viewtopic.php?f=3&t=1940&p=6680&hilit=shared+folder+apache#p6680
which leads on to this:
http://httpd.apache.org/docs/2.0/faq/error.html#error.sendfile
Disabling them fixed this problem for me!
Well there's definitely some caching going on somewhere.
My strategy for dealing with this is to append the filemtime() of the .css /.js file to the end of the link.
You end up with links like
<link type='text/css' rel='stylesheet' media='screen' href='stylesheet.css?1352889543' />
This way, neither the server nor the browser can possibly cache a file that has since been modified.

Categories