Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2017-11-07, 21:15:00

Author Topic: php pages not updating without browser refresh  (Read 1257 times)

0 Members and 1 Guest are viewing this topic.

Offline tonym

  • Valuable Member
  • *
  • Posts: 59
  • Karma: +0/-0
    • View Profile
php pages not updating without browser refresh
« on: 2016-12-07, 16:51:00 »
I have a problem with the content of php pages not updating when a page is revisited,  unless a web browser refresh is done.  This is on a newer server with Centos 6 & Kloxo (mtc1.uk).

I have an older server with Centos 5 and Kloxo (chelmsfordmc.co.uk) where the same php scripts work as expected.

I have made a simple test script. If you click on one of the Test Time links, go back in the browser, and then click it again later, the old time is still shown on mtc1.uk.

There is no caching installed.
Both servers have opcache on, but I have tried them with it off too.

The older server is OK using suphp. When I changed it to  php-fpm_event, the same problem occurred.

What can cause this to happen?

Thanks,
Tony



------------------------
Centos 5 server chelmsfordmc.co.uk


-bash-3.2# sh /script/sysinfo -y
A. Control Panel:
   - Kloxo-MR: 7.0.0.b-2016120401
   - Web: hiawatha-10.4.0-f.1.mr.el5
   - PHP: php53s-5.3.29-1.ius.el5 (fpm mode)
B. Plateform:
   - OS: CentOS release 5.11 (Final) i686
   - Hostname: vps2.chelmsfordmc.co.uk
C. Services:
   1. MySQL: MariaDB-server-10.0.28-1
   2. PHP:
      - Installed:
        - Branch: php55w-cli-5.5.38-1.w5
        - Multiple:
          * php52m-5.2.17-102.mr.el5
          * php53m-5.3.29-1.ius.el5
          * php54m-5.4.45-1.ius.el5
          * php55m-5.5.38-1.w5
          * php56m-
          * php70m-
      - Used: php55m-fpm
      - Multiple: enable
   3. Web Used: apache
     - Hiawatha: hiawatha-10.4.0-f.1.mr.el5
     - Lighttpd: lighttpd-1.4.39-3.el5
     - Nginx: nginx-1.11.6-1.el5.ngx
     - Apache: httpd-2.2.31-1.mr.el5
       - PHP Type: suphp
       - Secondary PHP: off
   4. WebCache: none
     - ATS: --uninstalled--
     - Squid: --uninstalled--
     - Varnish: --uninstalled--
   5. Dns: nsd
     - Bind: --uninstalled--
     - DJBDns: --uninstalled--
     - NSD: nsd-4.1.10-1.mr.el5
     - PowerDNS: --uninstalled--
     - Yadifa: --uninstalled--
   6. Mail: qmail-toaster-1.03-1.3.55.mr.el5
      - pop3/imap4: courier-imap-toaster-4.1.2-1.3.20.mr.el5
      - smtp: qmail-toaster-1.03-1.3.55.mr.el5
      - spam: --uninstalled--
   7. Stats: awstats
D. Memory:
                total       used       free     shared    buffers     cached
   Mem:          1024       1024          0          0          0        452
   -/+ buffers/cache:        571        452
   Swap:         1024        109        914
E. Disk Space:
   Filesystem            Size  Used Avail Use% Mounted on
   /dev/simfs             25G   16G  9.2G  64% /


---------------------------------------------------------
Centos 6 server mtc1.uk

A. Control Panel:
   - Kloxo-MR: 7.0.0.b-2016120401
   - Web: hiawatha-10.4.0-f.1.mr.el6.i686
   - PHP: php54s-5.4.45-1.ius.el6 (fpm mode)
B. Plateform:
   - OS: CentOS release 6.8 (Final) i686
   - Hostname: mail.mtc1.uk
C. Services:
   1. MySQL: MariaDB-server-10.0.28-1.el6.i686
   2. PHP:
      - Installed:
        - Branch: php55w-cli-5.5.38-1.w6.i386
        - Multiple:
          * php52m-5.2.17-102.mr.el6
          * php53m-5.3.29-1.ius.el6
          * php54m-5.4.45-1.ius.el6
          * php55m-5.5.38-1.ius.el6
          * php56m-5.6.28-1.ius.el6
          * php70m-7.0.13-1.w6
      - Used: php55m-fpm
      - Multiple: enable
   3. Web Used: apache
     - Hiawatha: hiawatha-10.4.0-f.1.mr.el6.i686
     - Lighttpd: lighttpd-1.4.43-2.el6.i686
     - Nginx: nginx-1.11.6-1.el6.ngx.i386
     - Apache: httpd24u-2.4.23-2.ius.el6.i686
       - PHP Type: php-fpm_event
       - Secondary PHP: off
   4. WebCache: none
     - ATS: --uninstalled--
     - Squid: --uninstalled--
     - Varnish: --uninstalled--
   5. Dns: none
     - Bind: --uninstalled--
     - DJBDns: --uninstalled--
     - NSD: --uninstalled--
     - PowerDNS: --uninstalled--
     - Yadifa: --uninstalled--
   6. Mail: qmail-toaster-1.03-1.3.55.mr.el6.i386
      - pop3/imap4: courier-imap-toaster-4.1.2-1.3.20.mr.el6.i686
      - smtp: qmail-toaster-1.03-1.3.55.mr.el6.i386
      - spam: --uninstalled--
   7. Stats: awstats
D. Memory:
                total       used       free     shared    buffers     cached
   Mem:          2909       2754        154         44        293       1728
   -/+ buffers/cache:        732       2177
   Swap:          511          1        510
E. Disk Space:
   Filesystem      Size  Used Avail Use% Mounted on
   /dev/vda1        39G  9.0G   28G  25% /

-----------------------
« Last Edit: 2016-12-18, 14:22:08 by tonym »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,381
  • Karma: +112/-9
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: php pages not updating without browser refresh
« Reply #1 on: 2016-12-07, 18:22:44 »
I didn't found this issue when tested.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline tonym

  • Valuable Member
  • *
  • Posts: 59
  • Karma: +0/-0
    • View Profile
Re: php pages not updating without browser refresh
« Reply #2 on: 2016-12-07, 21:36:16 »
I have checked this with 4 different web browsers, and from several different internet connections.
All the users of the services I have moved to the mtc1.uk server are suffering from this.

Is suphp (not suphp_event/suphp_worker) available in Kloxo7/Centos 6?
« Last Edit: 2016-12-18, 14:48:23 by tonym »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,381
  • Karma: +112/-9
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: php pages not updating without browser refresh
« Reply #3 on: 2016-12-08, 01:02:33 »
Better use suphp_event/_worker because better memory usage.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline tonym

  • Valuable Member
  • *
  • Posts: 59
  • Karma: +0/-0
    • View Profile
Re: php pages not updating without browser refresh
« Reply #4 on: 2016-12-08, 13:18:58 »
OK,  I now have both of them using suphp_event.
The problem remains: the Centos 5 server runs php scripts every time you visit a page,  and the Centos 6 one does not.

----
Centos 5 server chelmsfordmc.co.uk

A. Control Panel:
   - Kloxo-MR: 7.0.0.b-2016120401
   - Web: hiawatha-10.4.0-f.1.mr.el5
   - PHP: php53s-5.3.29-1.ius.el5 (fpm mode)
B. Plateform:
   - OS: CentOS release 5.11 (Final) i686
   - Hostname: vps2.chelmsfordmc.co.uk
C. Services:
   1. MySQL: MariaDB-server-10.0.28-1
   2. PHP:
      - Installed:
        - Branch: php55w-cli-5.5.38-1.w5
        - Multiple:
          * php52m-5.2.17-102.mr.el5
          * php53m-5.3.29-1.ius.el5
          * php54m-5.4.45-1.ius.el5
          * php55m-5.5.38-1.w5
          * php56m-
          * php70m-
      - Used: php55m-fpm
      - Multiple: enable
   3. Web Used: apache
     - Hiawatha: hiawatha-10.4.0-f.1.mr.el5
     - Lighttpd: lighttpd-1.4.39-3.el5
     - Nginx: nginx-1.11.6-1.el5.ngx
     - Apache: httpd-2.2.31-1.mr.el5
       - PHP Type: suphp_event
       - Secondary PHP: off
   4. WebCache: none
     - ATS: --uninstalled--
     - Squid: --uninstalled--
     - Varnish: --uninstalled--
   5. Dns: nsd
     - Bind: --uninstalled--
     - DJBDns: --uninstalled--
     - NSD: nsd-4.1.10-1.mr.el5
     - PowerDNS: --uninstalled--
     - Yadifa: --uninstalled--
   6. Mail: qmail-toaster-1.03-1.3.55.mr.el5
      - pop3/imap4: courier-imap-toaster-4.1.2-1.3.20.mr.el5
      - smtp: qmail-toaster-1.03-1.3.55.mr.el5
      - spam: --uninstalled--
   7. Stats: awstats
D. Memory:
                total       used       free     shared    buffers     cached
   Mem:          1024       1024          0          0          0        421
   -/+ buffers/cache:        602        421
   Swap:         1024        118        905
E. Disk Space:
   Filesystem            Size  Used Avail Use% Mounted on
   /dev/simfs             25G   16G  9.2G  64% /

----------
Centos 6 server mtc1.uk

A. Control Panel:
   - Kloxo-MR: 7.0.0.b-2016120401
   - Web: hiawatha-10.4.0-f.1.mr.el6.i686
   - PHP: php54s-5.4.45-1.ius.el6 (fpm mode)
B. Plateform:
   - OS: CentOS release 6.8 (Final) i686
   - Hostname: mail.mtc1.uk
C. Services:
   1. MySQL: MariaDB-server-10.0.28-1.el6.i686
   2. PHP:
      - Installed:
        - Branch: php55w-cli-5.5.38-1.w6.i386
        - Multiple:
          * php52m-5.2.17-102.mr.el6
          * php53m-5.3.29-1.ius.el6
          * php54m-5.4.45-1.ius.el6
          * php55m-5.5.38-1.ius.el6
          * php56m-5.6.28-1.ius.el6
          * php70m-7.0.13-1.w6
      - Used: php55m-fpm
      - Multiple: enable
   3. Web Used: apache
     - Hiawatha: hiawatha-10.4.0-f.1.mr.el6.i686
     - Lighttpd: lighttpd-1.4.43-2.el6.i686
     - Nginx: nginx-1.11.6-1.el6.ngx.i386
     - Apache: httpd24u-2.4.23-2.ius.el6.i686
       - PHP Type: suphp_event
       - Secondary PHP: off
   4. WebCache: none
     - ATS: --uninstalled--
     - Squid: --uninstalled--
     - Varnish: --uninstalled--
   5. Dns: none
     - Bind: --uninstalled--
     - DJBDns: --uninstalled--
     - NSD: --uninstalled--
     - PowerDNS: --uninstalled--
     - Yadifa: --uninstalled--
   6. Mail: qmail-toaster-1.03-1.3.55.mr.el6.i386
      - pop3/imap4: courier-imap-toaster-4.1.2-1.3.20.mr.el6.i686
      - smtp: qmail-toaster-1.03-1.3.55.mr.el6.i386
      - spam: --uninstalled--
   7. Stats: awstats
D. Memory:
                total       used       free     shared    buffers     cached
   Mem:          2909       2708        200         33        293       1674
   -/+ buffers/cache:        739       2169
   Swap:          511          1        510
E. Disk Space:
   Filesystem      Size  Used Avail Use% Mounted on
   /dev/vda1        39G  9.0G   28G  25% /
---------------

In phpinfo() I see a difference in  the loaded php.ini:


One says Server API "CGI/FastCGI",  and the other "FPM/FastCGI".
One loads /home/httpd/chelmsfordmc.co.uk/php.ini, the other /opt/php55m/custom/php-fpm.ini, so I don't seem to have managed to set things up the same.

« Last Edit: 2016-12-14, 13:19:39 by tonym »

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,381
  • Karma: +112/-9
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: php pages not updating without browser refresh
« Reply #5 on: 2016-12-08, 13:36:36 »
Except php-fpm, other always use 'default' php (aka 'php branch'). That why you different paths of modules ('/etc/php.d/' or '/opt/php55m')

Also, that why you see different 'Server API' ('CGI/FastCGI' or 'FPM/FastCGI').
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline tonym

  • Valuable Member
  • *
  • Posts: 59
  • Karma: +0/-0
    • View Profile
Re: php pages not updating without browser refresh
« Reply #6 on: 2016-12-08, 14:13:07 »
OK, but both seem to be on the same `php branch` in the sysinfo output, and I had run `sh /script/restart-web' to be sure.


Using Chrome "Web Sniffer", I see the HTTP response header from the mtc1.uk server have:
Cache-Control    max-age=604800
Expires               Thu, 15 Dec 2016 12:56:10 GMT
Further requests to the same page are marked as (cache), which is why the pages do not update.


Even the pages where I have added HTML headers like this do not work.
---
        <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
        <META HTTP-EQUIV="Expires" CONTENT="-1"></head>
   <meta http-equiv="cache-control" content="no-cache, must-revalidate">
---


What controls those response headers? Apache or PHP?
I'll keep digging!

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,381
  • Karma: +112/-9
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: php pages not updating without browser refresh
« Reply #7 on: 2016-12-08, 15:14:33 »
Try explore 'web basics' and 'web features' for certain websites/domains.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline tonym

  • Valuable Member
  • *
  • Posts: 59
  • Karma: +0/-0
    • View Profile
Re: php pages not updating without browser refresh
« Reply #8 on: 2016-12-08, 17:54:37 »
In the control panel Domain -> Web Features I see bits that relate to the headers and expires lines I found in /opt/configs/apache/conf/domains/mtc1.uk.conf.
 I tried setting "Static Files Expire" to -1 for the domain, but did not see a difference for the php files.


I have tried commenting out the line:
LoadModule expires_module modules/mod_expires.so
in /etc/httpd/conf.modules.d/00-base.conf, and that stops the expired headers for everything,
So php files work normallly, but the useful  caching is lost.


With mod_expires back  in again, I tried editing
 /opt/configs/apache/conf/domains/mtc1.uk.conf

In  the web section for my domain:

        <IfModule mod_headers.c>
                Header always set X-Content-Type-Options "nosniff"
                Header always set X-XSS-Protection "1;mode=block"
                Header always set X-Frame-Options "SAMEORIGIN"
                Header always set Access-Control-Allow-Origin "*"
                Header always set X-Supported-By "Kloxo-MR 7.0"
                RequestHeader unset Proxy early
        </IfModule>

        <IfModule mod_expires.c>
                ExpiresActive On
                ExpiresByType image/x-icon "access plus 7 days"
                ExpiresByType image/gif "accesss plus 7 days"
                ExpiresByType image/png "access plus 7 days"
                ExpiresByType image/jpg "access plus 7 days"
                ExpiresByType image/jpeg "access plus 7 days"
                ExpiresByType text/css "access plus 7 days"
                ExpiresByType application/pdf "access plus 7 days"
                ExpiresByType text/x-javascript "access plus 7 days"
                ExpiresDefault "access plus 7 days"
        </IfModule>

Changing the text in "X-Supported-By" did not show up in the headers.
Trying  ExpiresDefault "access plus 1 seconds"
  did not change the headers for php.
Changes to this file don't seem to take effect after a restart-web.

Am I editing the wrong place?



I have tried this in a .htacccess file, but did not see any difference:
---
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
<FilesMatch \.php$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off
</FilesMatch>
</IfModule>
---
That was from a Drupal installation, and looked useful.


For now the quick fix is to disable mod_expires. I hope the default configuration can be changed so it doesn't affect dynamic files.

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,381
  • Karma: +112/-9
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: php pages not updating without browser refresh
« Reply #9 on: 2016-12-09, 03:33:40 »
Try disable using pagespeed.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline tonym

  • Valuable Member
  • *
  • Posts: 59
  • Karma: +0/-0
    • View Profile
Re: php pages not updating without browser refresh
« Reply #10 on: 2016-12-09, 08:07:27 »
It isn't on in the control panel.

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,381
  • Karma: +112/-9
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: php pages not updating without browser refresh
« Reply #11 on: 2016-12-09, 08:50:52 »
Global setting in 'switch program' and website-based setting 'web features'.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline amitkumar

  • Valuable Member
  • *
  • Posts: 73
  • Karma: +1/-0
  • Gender: Male
    • View Profile
    • webquicksolution
Re: php pages not updating without browser refresh
« Reply #12 on: 2016-12-12, 12:33:13 »
same thing happening to me. 

Offline MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,381
  • Karma: +112/-9
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: php pages not updating without browser refresh
« Reply #13 on: 2016-12-12, 14:56:14 »
Try clear browser cache and history.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline tonym

  • Valuable Member
  • *
  • Posts: 59
  • Karma: +0/-0
    • View Profile
Re: php pages not updating without browser refresh
« Reply #14 on: 2016-12-18, 15:16:27 »
The mod_expires setup looks a good idea, but I do not think the
ExpiresDefault "access plus 7 days"
is a good idea. At least I think that is the line that causes php pages to be cached.


I do not have PageSpeed turned on or installed.

In yum I see a "mod-pagespeed-stable". Is that something that could help?
Description : mod_pagespeed is an Apache module that aims to speed up load time of pages by   applying web performance best practices automatically.

Although you were telling me to turn it off, would installing it provide an alternative to the current mod_expires setup?



 


MRatWork Affiliates:    BIGRAF(R) Inc.    House of LMAR    EFARgrafix
Click Here

Page created in 0.041 seconds with 17 queries.

web stats analysis
 
Mirror created by MasterkinG32.CoM