PatRoy Posted February 22, 2020 Share Posted February 22, 2020 Hello folks, I'm running PHP Version 7.1.4, on Lighttpd 1.4.32 on my old NAS device (so can't really do PHP /Lighttpd updates). I'm developing this project that uses sessions, but have a really annoying problem where every time I do a change in a PHP file, reloading the page in my browser won't show the change right away, as if it was cached somehow, showing still older version... I have to keep hitting reload in my browser for, let's say ~40 seconds or so, and at some point, it will show my changes. This drives me nuts when trying to troubleshoot a problem! The thing is, it happens only with PHP files. Changes in regular HTML files are reflected right away. I've tried the followings in order to pin-out the problem: cleared my browser's cache completely added the following cache-control directives inside my Lighty server config file: setenv.add-response-header += ("Cache-Control" => "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0, post-check=0, pre-check=0") set nocache session limiter in php.ini: session.cache_limiter = nocache manually changed the HTTP Headers right from the PHP file: header("Expires: Tue, 03 Jul 2001 06:00:00 GMT", true); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT", true); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0", true); header("Pragma: no-cache", true); header("Connection: close", true); Problem always remains the same. And yes, I did confirm with a HTTP Headers Chrome plugin that the headers were indeed modified on every try that I did above... As of try#4, my headers in my PHP files look like: Content-Language en P3P CP='CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR' Cache-Control no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0, post-check=0, pre-check=0 Cache-Control no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0 X-Powered-By PHP/7.1.4 Expires Tue, 03 Jul 2001 06:00:00 GMT Last-Modified Sat, 22 Feb 2020 20:18:01 GMT Pragma no-cache Connection close Content-Encoding gzip Vary Accept-Encoding Content-type text/html; charset=UTF-8 Transfer-Encoding chunked Date Sat, 22 Feb 2020 20:18:01 GMT Server lighttpd/1.4.32 Running out of ideas here... Any help would be great! Cheers, Pat Quote Link to comment https://forums.phpfreaks.com/topic/310106-php-pages-updates-slow-to-reflect-in-browser/ Share on other sites More sharing options...
requinix Posted February 22, 2020 Share Posted February 22, 2020 Can you post/link to your phpinfo()? Quote Link to comment https://forums.phpfreaks.com/topic/310106-php-pages-updates-slow-to-reflect-in-browser/#findComment-1574785 Share on other sites More sharing options...
kicken Posted February 23, 2020 Share Posted February 23, 2020 Open your browsers development console (F12) and disable the use of cache (Network tab -> [X] Disable Cache) and see if that resolves the problem. If it does, you know it's a browser cache issue. If it doesn't, you know the problem lies elsewhere. Have you experienced the issue in multiple browsers, or have you only been using one? Quote Link to comment https://forums.phpfreaks.com/topic/310106-php-pages-updates-slow-to-reflect-in-browser/#findComment-1574792 Share on other sites More sharing options...
PatRoy Posted February 23, 2020 Author Share Posted February 23, 2020 (edited) Here's my phpinfo() : http://corbeauperdu.ddns.net/phpinfo.php I tried disabling cache from my browser's dev tools , as you said kicken, but problem remains Additional info, if it applies, I'm running php-cgi and not php-fpm on server because the fpm one seems to work slower for me.... (it's a very old NAS) ... fastcgi.server = ( ".php" => ("localhost" => ("bin-path" => "/ffp/bin/php-cgi", "socket" => "/tmp/php-cgi.socket", "bin-environment" => ( "PHP_FCGI_CHILDREN" => "0" ), "max-procs" => "1") ) ) # also had these instruction in my lighty config... don't (yet) what it's for... server.max-request-size = 65536 server.network-backend="writev" server.use-noatime = "enable" Edited February 23, 2020 by PatRoy Quote Link to comment https://forums.phpfreaks.com/topic/310106-php-pages-updates-slow-to-reflect-in-browser/#findComment-1574801 Share on other sites More sharing options...
requinix Posted February 23, 2020 Share Posted February 23, 2020 According to the opcache.revalidate_freq setting, your server is only looking for changes to PHP scripts once every minute. I think that is a reasonable amount of time. Can you do your development and testing locally instead? That really is a good practice to learn, and you should be doing it regardless of this caching thing. Quote Link to comment https://forums.phpfreaks.com/topic/310106-php-pages-updates-slow-to-reflect-in-browser/#findComment-1574804 Share on other sites More sharing options...
PatRoy Posted February 23, 2020 Author Share Posted February 23, 2020 1 hour ago, requinix said: According to the opcache.revalidate_freq setting, your server is only looking for changes to PHP scripts once every minute. I think that is a reasonable amount of time. Can you do your development and testing locally instead? That really is a good practice to learn, and you should be doing it regardless of this caching thing. I just tried changing this setting to '0' and it fixed the issue.... I can't really develop locally, so I'll set this to 0 seconds while I'm developping my project, and change it back to 60 afterwards. Thanks for your help :)) Quote Link to comment https://forums.phpfreaks.com/topic/310106-php-pages-updates-slow-to-reflect-in-browser/#findComment-1574808 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.