Cache Data (OLD DATA) repeatedly appears while an user use my WEB server, why it happens?

Hi !! Everyone at WEB-Server administrators, or Perl-CGI programmers, or experts about the module of php-fpm. !!
I have been observing very weird phenomena as a WEB-Server’s reaction. That is very frequently a few month OLD PAST DATA (as a PHP file content as well as Perl-CGI response data). I suspected two possibilities of Cache Data (OLD FILE content preserved). (1) Local Computer side, Browsers Cache Memory retained data. Firefox, Safari, Google-Chrome. (2) WEB-Server side of daemon configuration mal-adjustment. Such as www.conf ( /etc /php-fpm.d / www.conf ), or httpd.conf (/etc/ httpd / conf/ httpd.conf ), I have no idea about how WEB-SERVER possibly can hold OLD DATA, and how should I be able to adjust my WEB-SERVER to refresh-or-read the newer file data (php files as well as html files, or even simple Text data file which was read by my Perl-CGI scripts). Probably I need to study deeper about the configuration files ( httpd.conf and php-fpm.d/ www.conf ). Is there out there, someone, who has the similar problem encountered, and find out a solution ? Thanks.

PHP by default will have the opcache module enabled, which will cache pages generated by PHP content. If the content hasn’t changed, and it’s cached for X months, then there is no problem. Usually I worry about cached data when pages change, and thay aren’t loading the new ones in the browsers. But that is usually down to the web server telling the browsers to use content for X months (expires module in Apache for example).

Thanks again, iwalker, for your very insightful comment. What is the usual way to take a control (or configure) the opcache module’s parameter in PHP ? Or may I disable the opcache ? How may I do ? If I disable opcache, is there any serious bad effect on WEB-casting ? Thanks, thanks, always.

You can remove php-opcache package if it’s installed:

dnf remove php-opcache
2 Likes

Hi ! iwalker, thanks for your quick reply. Removing the php-opcache is a just moderate measure, isn’t it. Then I will proceed to remove. Meanwhile, I studied about the following way,

opcache.enable=1 (Enable)
opcache.enable=0 (Disable)

in a PHP configuration file, /etc/php.d/10-opcache.ini file,
Just as a way of PHP configuration. Well, which way do you suggest? Just simple removal as you mentioned above, or switching way in a configuration file as just I learned. Thanks, thanks.

Hi ! iwalker ! Let me try it out of your way (dnf remove ) at first, then let me see a while regarding my WER-SERVER’s reaction. Up to now, I have been doing thousands of ADDing (dnf install xxx), but I never had done any (dnf remove), so it will be an interesting experiment. I will feedback you about this experiment. M.K.

Hi ! Everyone, there. How are you ? Well, I just removed php-opcache. Does php-fpm work as Cache of OLD DATA holding in order to make WEB-SERVER respond quickly. If so, I have to seriously study php-fpm as well. May I doubt php-fpm as a possible suspect of OLD DATA holding.
Let me know (please feedback to me any your experience of OLD DATA appearing after NEW files are already in). Thanks.

Opcache can be disabled as you mentioned by editing the ini file. I prefer to remove unused modules from the system rather than leave them installed. Sometimes though this isn’t a possibility since it may be a dependency for something else.

When enabled it will cache, but you will also need to check the PHP application as well as it may use a file cache on the disk. Some PHP frameworks do this unless configured otherwise. PHP applications, like Joomla for example can be configured with cache disabled.

It’s very hard to answer the questions without knowing exactly what the application in use is.

Thank again, iWakler, for your nice comment about PHP and cache. My WEB-SERVER is running with a standard Perl (5.32.1) and PHP (8.2.0) with php-fpm in Rocky9.1 . One addtional module My WEB-SERVER have been using for years is CGI.pm (Lincoln Stein’s good module which makes a good link between Perl script program in /cgi-bin/ and PHP files in /www/html/). Other than this CGI.pm, I don’t have any idea about any extra application running inside of my Rocky9.1 Up to now, I suspected two locations of Cache; (1) at Local Computer’s WEB Browser (Client side), (2) at the WEB-SERVER side (Server side). Then, now suddenly, I can consider the more third location, that is a ROUTER device which is installed at my home room in my condominium. That is a NTT product, Router Model RT-500 KI (a Japanese Telephone/Telegraph company’s product). Well, I am looking around everywhere.

Good morning mkido. What webserver are you using? Apache?

add this line to your php.ini:

apc.enabled=0

and then restart apache or nginx depending on what you’re using

This will make your changes show instantly on any client web browser

p.s: You can always see if you have any caching enabled by creating a simple php page containing

<?php phpinfo(); ?>

Hope it helps!

Not prudent to disable PHP Opcache. OPcache stores precompiled script bytecode in shared memory, improving PHP performance. It caches opcode, allowing scripts to be served directly from the cache. This reduces CPU and memory usage, optimizing resource utilization and enhancing PHP application scalability.

You can use cachetool (GitHub - gordalina/cachetool: CLI App and library to manage apc & opcache.) to interrogate the cache. It can also be use to clear the cache but just restarting/reloading the PHP-FPM service will also clear the cache.

Be aware this only applies to precompiled BYTECODE not to the SHOWN OUTPUT of web page(s) dynamically generated by the web server. You will need to add Cache Control headers for any script generating dynamically generated output (Setting Cache control headers for common content types Nginx and Apache).

1 Like

Hello ! Everyone, I have been observing My WEB-SERVER’s behavior for the last few days, and it is satisfactory to me. Thanks again to
iwalker,
alexia,
ganphx

I will close this posting here. Have a HAPPY NEW YEAR to everyone. Deeply thank to you all.
By the way, I don’t know how to close my post. I just marked iwalker’s post as a solution. Bye now.

2 Likes

@mkido Arigato! Wishing you a Happy New Year also! The thread will auto-close anyway in the near future.

Hi,

After many experiment we are using below opcache setting for our servers.

opcache.memory_consumption= 512
opcache.validate_timestamps=1
opcache.revalidate_freq=10
opcache.interned_strings_buffer=16

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.