Strange server caching problem.

Borre

Verified User
Joined
Dec 4, 2017
Messages
7
Hi!

Some weeks ago I did an update on my CustomBuild 2.0 set up (just an update, no change of config at all).
And since than my server seems like caching files for 5 minutes before they update to the world.

Example:
For developing I'm using notepad++ with the FTP extension so I can do direct changes in PHP files and see them directly live after save ( = FTP upload ).

But since the last update I did, I need to wait like 5 minutes before it updates in my browser.

I first thought it was my browser caching things, but on the FTP of the company I work for, there are no any issues like this - there it updates immediately..

I tried finding any settings of caching enabled, but I did not enable any caching settings myself, what I did see that there is/was mod_expires being loaded as (static) but I tried to disable that without any result.
After reading some things for speeding up the server, today I switched from 'apache' mode to 'nginx_apache' mode but still the same issue.

Strangest thing is, I haven't had this before, but now it really starts annoying me as developing slows down alot.. :/

System running:
Centos 6.0
CustomBuild 2.0 (1774)
DirectAdmin 1.52.1

Thanks in advance!

Kind regards
 

adam12

Verified User
Joined
Feb 19, 2016
Messages
66
How are you telling they are being cached? Are you looking at cache headers in your browser or just assuming?

Do you have a .htaccess file in your document root? If so, what's in it?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
Hello,

For developing I'm using notepad++ with the FTP extension so I can do direct changes in PHP files and see them directly live after save ( = FTP upload ).
opcache enabled in PHP?


Code:
php -v
 

Borre

Verified User
Joined
Dec 4, 2017
Messages
7
Hello,



opcache enabled in PHP?


Code:
php -v
Hi!

This was the output,.. so I think it is..

Code:
PHP 5.6.32 (cli) (built: Oct 30 2017 22:07:03)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
All though, my settings say something else... ?

https://screenshots.firefoxusercontent.com/images/739e37e5-44b9-474d-b7b7-1c603fc9c5a8.png

Kind regards,
 

Borre

Verified User
Joined
Dec 4, 2017
Messages
7
you need to rebuild php or php.ini
Hi, thanks.

Just updated the configuration as OpCache was on indeed.

Still, it doesn't instant update. So maybe anything else possible or should I disable the zend framework fully?


Cache headers look like these so seems ok?
Code:
no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Or can this be the nginx I updated to yesterday? (Don't think so but, yeah..)

Kind regards
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
Are you sure that OPcache is now disabled? Did you check output?

Code:
php -v
 

ikkeben

Verified User
Joined
May 22, 2014
Messages
792
Location
Netherlands Germany
Though if caching is off:

You have to check with other browser, other Computer and other Internetprovider to be sure where this caching is done.

So if same file is called from other computer, other internet provider maybe other browser then if you have caching probably this is then on the server. ( but still could be that your hoster or extra "box" between that is using caching to for whatever reasons even is cache of the server and so on is off.)

If no same cached content then for sure if not at sessions/cookie cache you have to look somewhere else i think.
 

Borre

Verified User
Joined
Dec 4, 2017
Messages
7
Are you sure that OPcache is now disabled? Did you check output?

Code:
php -v
Yes, checked multiple times :(

Though if caching is off:

You have to check with other browser, other Computer and other Internetprovider to be sure where this caching is done.

So if same file is called from other computer, other internet provider maybe other browser then if you have caching probably this is then on the server. ( but still could be that your hoster or extra "box" between that is using caching to for whatever reasons even is cache of the server and so on is off.)

If no same cached content then for sure if not at sessions/cookie cache you have to look somewhere else i think.
All has been checked, it's the server that caches ...

We rent this Dedicated Server but can ask for help at the company where it is being hosted if we/I cannot find any solution.. :/

Kind regards
 

Borre

Verified User
Joined
Dec 4, 2017
Messages
7
Hi!

I found a solution!

As I pasted the cache headers before, I created a .htaccess file and put the next inside:
Code:
Header set Cache-Control "no-cache"
So all the rest which showed up is gone.

Now everything works as it should.

But the question now is, how can I do this permanent? Where can I change the standard cache-control setting ?

Kind regards!
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
You should check your application settings, I did not find anything in Apache which would make files to cache.
 

Borre

Verified User
Joined
Dec 4, 2017
Messages
7
You should check your application settings, I did not find anything in Apache which would make files to cache.
So maybe I need to enable and configure mod_expose so it will be standard ?
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
Apache is already built with mod_expires by default, check with:

Code:
# apachectl -M 2>&1 | grep expires
 expires_module (static)
 

Awd

Verified User
Joined
Aug 9, 2015
Messages
316
HI,

I have the same problem since a couple of days. When I change something in Wordpress through file editing and save the file, check the same file with FTP, there has been no changes at all. Vica versa the same. First I thought it is related to a Wordpress update, but when I reverse it is the same. Any idea?
 

Alen

Verified User
Joined
Oct 2, 2019
Messages
10
i have the same problem, i change PHP file and upload to serve over SFTP and there is no change at server but IDE show me
Code:
Automatic upload completed in less than a minute: 1 file transferred (15.4 kbit/s)
i rebuild PHP
last what i get:
Code:
imap PHP extension has been installed successfully.
PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library) 'imap.so' in Unknown on line 0
Enabling php-fpm73 in systemd...
Restarting apache.
Rewriting all users httpd.conf files, please wait...
Debug mode. Level 10

dataskq: command: action=rewrite&value=httpd
PHP 7.3.18 Installed.
[root@ custombuild]# php -v
PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library) 'imap.so' in Unknown on line 0
PHP 7.2.31 (cli) (built: May 31 2020 20:22:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
this one with imap.so start showing from last update directadmin
i tried also with Header set Cache-Control "no-cache" in .htaccess but without success

i think this is related with apache cache module

how i can disable module in apache?

Code:
Loaded Modules:
core_module (static)
authn_file_module (static)
authn_dbm_module (static)
authn_anon_module (static)
authn_dbd_module (static)
authn_socache_module (static)
authn_core_module (static)
authz_host_module (static)
authz_groupfile_module (static)
authz_user_module (static)
authz_dbm_module (static)
authz_owner_module (static)
authz_dbd_module (static)
authz_core_module (static)
access_compat_module (static)
auth_basic_module (static)
auth_form_module (static)
auth_digest_module (static)
allowmethods_module (static)
file_cache_module (static)
cache_module (static)
cache_disk_module (static)
cache_socache_module (static)
socache_shmcb_module (static)
socache_dbm_module (static)
socache_memcache_module (static)
socache_redis_module (static)
so_module (static)
watchdog_module (static)
macro_module (static)
dbd_module (static)
dumpio_module (static)
buffer_module (static)
ratelimit_module (static)
reqtimeout_module (static)
ext_filter_module (static)
request_module (static)
include_module (static)
filter_module (static)
substitute_module (static)
sed_module (static)
deflate_module (static)
http_module (static)
mime_module (static)
log_config_module (static)
log_debug_module (static)
logio_module (static)
env_module (static)
expires_module (static)
headers_module (static)
unique_id_module (static)
setenvif_module (static)
version_module (static)
remoteip_module (static)
proxy_module (static)
proxy_connect_module (static)
proxy_ftp_module (static)
proxy_http_module (static)
proxy_fcgi_module (static)
proxy_scgi_module (static)
proxy_uwsgi_module (static)
proxy_fdpass_module (static)
proxy_wstunnel_module (static)
proxy_ajp_module (static)
proxy_balancer_module (static)
proxy_express_module (static)
proxy_hcheck_module (static)
session_module (static)
session_cookie_module (static)
session_dbd_module (static)
slotmem_shm_module (static)
ssl_module (static)
http2_module (static)
lbmethod_byrequests_module (static)
lbmethod_bytraffic_module (static)
lbmethod_bybusyness_module (static)
lbmethod_heartbeat_module (static)
unixd_module (static)
systemd_module (static)
dav_module (static)
status_module (static)
autoindex_module (static)
info_module (static)
suexec_module (static)
cgi_module (static)
dav_fs_module (static)
dav_lock_module (static)
vhost_alias_module (static)
negotiation_module (static)
dir_module (static)
actions_module (static)
speling_module (static)
userdir_module (static)
alias_module (static)
rewrite_module (static)
mpm_event_module (shared)
 
Last edited:
Top