Since about a week I've got a very strange caching problem. I did not make any changes I know of which could possibly lead to this problem.
It happens using:
PHP 8.1.9
Apache 2.4.48 or the built-in symfony web server
PHPStorm or notepad++
symfony or just plain PHP
Firefox or Edge
My output gets cached somehow. I can completely destroy the PHP code or rename/delete files -> still displayed correctly. Some time later it finally refreshes and displays the errors. The errors themselves don't get cached. Fixing them immediately returns the script to the expected behaviour. I've already disabled caching inside Firefox (in the settings and setting disk.cache.enabled to false), but it happens with Edge, too.
The only common thing my experiments share is the PHP version/installation, it probably does not have to do anything with Apache, symfony or the browser.
Any ideas?
I've found the answer.
Somehow opcache.revalidate_freq inside the php.ini was set to 200 and zend_extension=opcache enabled. I've never changed this manually. Would be interesting to find out what caused the change.
Related
I've been experiencing an odd issue where something is getting cached somewhere and I'm not sure which item to blame and it's not only driving me nuts, but slows down my development workflow (and is VERY confusing).
The Problem: I save changes made to a PHP file and refresh my browser, however the changes do not show up.
Expected Behavior: The refreshed browser shows the updated file.
Actual Behavior: The most recent changes do not show up.
For some background, here are the possible factors that could be contributing to this problem:
Macbook Pro (16-inch, 2019, 2.6 GHz 6-Core Intel Core i7)
Mac OS (Monterey v12.5)
Chrome (v104.0.5112.79)
MAMP Pro (6.6 Build 33836), Apache (2.4.46), PHP (7.4.21), MySQL (5.7.34)
Xdebug
PhpStorm (2022.2 Build #PS-222.3345.135)
Gulp (v4.0.2) - Unlikely
BrowserSync (v2.26.14) - Unlikely
I work with WordPress although I don't think that's a factor here. Basically what is happening is I'll go to make a change to a PHP file, which could be just adding more code, fixing an error, or maybe even doing a var_dump, and when BrowserSync refreshes, the changes are not reflected, so the new code does nothing, or the error still exists, or the var_dump doesn't show up. Another example is once var_dump does work, if I go to remove that debugging line, it will still show up.
I haven't figured out a fix either, other than just repeatedly refreshing the browser or re-saving the file (sometimes after adding a few blank lines to "trick" whatever it is causing it to think the file has not been changed). This can happen with or without running Gulp/BrowserSync, but I don't want to rule this out as a potential part of the problem. It's behaving like the file has not been saved.
I sometimes will quit gulp and restart to see if that resolves the issue, although it's hard to tell if it has any effect since the problem persists for maybe 30 seconds and then I'm able to see the updated file.
This is something that has recently started to happen but doesn't happen consistently. Sometimes everything works as expected, but it's hard to tell what factors are contributing to when the issue starts happening again. Most recently it started again after I restarted PhpStorm (to apply an update).
Has anyone else experienced something like this? I'm not even sure what other information would be helpful, but would be happy to post more details if I'm missing something. Thanks!
Bit of an odd one, but my development activity has been crippled by the loss of error messages in my DevTools. It was working yesterday, and from what I can see nothing on my system has changed.
The issue isn't browser related as it's impacting Chrome, FireFox and Edge; none of them display errors any more:
I saw in another SO question that someone had xDebug installed which was apparently caused this same issue for many folks. I also had it installed and believe I have removed it completely (perhaps there are remnants of its config somewhere?). Unfortunately I'm no better off from removing it.
Now that I can safely say the issue isn't browser related, I guess it can only be either my PHP config or Apache(WAMP) config?
The following PHP functions are compiled on my development environment, but I also wrote them at the top of my broken script for good measure and it made no difference.
error_reporting(E_ALL);
error_reporting(-1);
ini_set('error_reporting', E_ALL);
PHPInfo() confirmed that I'm showing and logging PHP errors also:
I got a little fed up so I uninstalled WAMP64 and installed the latest version (I know, taking a sledgehammer to crack a nut...) and it hasn't helped.
Any ideas?
I have been asked to move a PHP application to another environment. I set up PHP installation, and moved 2 PHP applications and. got that working.
But one application I moved is not working... it just renders a blank screen.
When I say Localhost/ApplicationName, it lists the application folders and PHP files in it. When I click on it, the browser goes blank.
Can somebody point out a step-by step trouble shooting ways to test this?
there are a lot of ways a php file can return a blank page
first make sure the file did work on the previous environment, if it didn't then it's a different issue entirely
do the following in order of what you suspect to be most probable:
you can go into the php.ini file, and set the error variables to the development defaults, then check if it returns any usable errors
^this is what I use all the time for fatal issues, always set it back to it's original afterwards though
or check the errorlogs, as JimL suggested
if it worked on the previous env then you need to find out what the differences are between both environments.
things like, php.ini setting, IIS vs apache or whatever http server, linux vs windows
check if any of the php pages return anything at all (for example, in firefox, rightclick+inspect element, then use the network tab)
if it's a 500 error, the file probably has an error (and the server is configured to return 500 on an error)
if the file isn't too large, you can go through the file and use common programming sense to see if you can easily spot the error (stuff like links to nonexisting files, etc, shouldn't be too hard even without php experience)
when it links to files, also check if the notation is correct for the windows IIS
feel free to give more information in your OP, or in a comment, if you find out any information, and I'll do my best to help
disclaimer, I have no specific IIS knowledge, I work with apache (both windows and linux)
I've recently switched my web server to Centos 6.3, with apache 2.2.15, PHP 5.4.11 and APC 3.1.14.
I started receiving complaints from customers from time to time, that a page is not working, or strange errors appear. I saw that the affected pages have question marks and other strange symbols in random places in the output, even though the sources are OK. When I change a single letter in the source file, the page starts working fine.
I suspect APC, but I cannot find any clue when and why this happens.
I use mercurial to push changes to production, but I've used this approach for years with no problem. Maybe something in the configuration is new now, but sadly I don't keep my old configuration.
Below is a screenshot from the last corruption.
Edit: Here's the response after I've changed a single character in the source, saved it, and then undo the files (same is if I just restart the web server or clear APC opcode cache):
Notice the line numbers didn't match, but it's 100% the same request, so the response should be the same also. The line 111 from the first screenshot should not be there at all. It seems that it's from another source file...
I've changed apc.stat_ctime to 1
Verification with ctime will avoid problems caused by programs such as svn or rsync by making sure inodes haven't changed since the last stat. APC will normally only check mtime.
I'll be watching closely on the problem, because it's occurring once or twice a week and post here if this fixed it.
For some reason, I get a HTTP 330 error whenever a PHP error is printed. This didn't use to happen, but since we had to restore our PHP application from a backup due to a server failure, it does. During that restoration, we switched over from using Apache to nginx + fastcgi. However, I'm also running the application locally, and I'm noticing the same issue on Apache, but only when using php 5.3.X. The application used to run on 5.2.11.
Has anyone encountered anything like this before? The only thing that googling has brought up is that maybe the PHP errors are sent using one encoding, and the rest of the content is sent gzipped, but I have no idea how to fix that - if it even is the problem.
Please ask if you need any more information. I'm not quite sure what information I could provide you with that would be helpful.
Enabling zlib compression in php.ini (zlib.output_compression = On) and then removing any ob_start("ob_gzhandler"); from the scripts seems to have solved the problem.