For some odd reason, every time I update a file, it is not updating inside a browser (localhost - wampserver). To be more specific. If I have a simple php script:
echo "hello world";
It runs fine in the browser, and shows the text 'hello world'.
However, if I update it to
echo "goodbye world";
And refresh the browser, nothing happens. The text remains 'hello world'.
This has not been a problem before and was refreshing perfectly. I tried clearing the browser cache, tested on multiple browsers, restarted my wamp server, and restarted the computer. Nothing seems to be working.
The only way the code seems to be updated is if I run the script from my IDE. Then it shows up in the browser with the updated code. How can this problem be fixed? I want it to go back to the way it was and be able to refresh from within the browser.
Using wampserver php - 5.3.13, apache 2.2.22
So possible reasons could be: PHP is not installed properly on your system or the server is not properly installed. PHP module isn't loaded in your apache. You did not put your scripts in the right place.
You have not setup the php interpreter correctly with your http server. If you are using apache2 .. then you need to setup PHP with apache. and uncomment LoadModel php5_module …. Originally Answered: Why won't my PHP code work?
Conclusion. As you have learned, running a PHP file directly in the Chrome browser is not possible. However, there is great software such as XAMPP that will help you to run and test your php file.
Your script cached in memory with opcache feature. Disable it in php.ini
:
opcache.enable = 0
But you also have to restart server. If you use hosting, use control panel to restart or try to change php version to another and revert.
Since this is the first result on Google when searching for this kind of issue, I'd like to add that if you have opcache enabled, you don't necessarily need to disable it completely.
You probably have opcache.validate_timestamps
set to 0
which will stop the automatic update of your files based on the last modification date.
Modify this parameter in your php.ini file:
opcache.validate_timestamps = 1
Restart the php-fpm service (or apache depending on your situation) and your script should be up to date at the next execution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With