A
A
Alex Raven2022-02-24 04:29:28
PHP
Alex Raven, 2022-02-24 04:29:28

How to beat the delay when displaying changes in a PHP script on AWS?

In general, the situation is like this. Trying to use Amazon Lightsail as a Development server. I am creating an instance - Wordpress stack from Bitnami on Debian 10. Server configuration is minimal: 512 MB RAM / 1 vCPU / 20 Gb SSD. Wordpress is already preinstalled and configured, just download plugins and themes. But here's the problem. When I change any file on the server, be it PHP, CSS or JS, the changes are not immediately visible. When you refresh the page in the browser, there is no change for about a minute. And then abruptly refreshed. I wrote a test script that shows the delay between the file being written to the server and the current time. In this case, it was 1 minute 18 seconds.

filemtime() = Thu, 24 Feb 2022 01:09:01 +0000
time() = Thu, 24 Feb 2022 01:10:19 +0000


I understand that some caching is enabled there by default. No matter how much I studied the Apache configuration, I did not find anything like that.

Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 mpm_event_module (shared)
 authn_file_module (shared)
 authn_core_module (shared)
 authz_host_module (shared)
 authz_groupfile_module (shared)
 authz_user_module (shared)
 authz_core_module (shared)
 access_compat_module (shared)
 auth_basic_module (shared)
 socache_shmcb_module (shared)
 reqtimeout_module (shared)
 filter_module (shared)
 deflate_module (shared)
 mime_module (shared)
 log_config_module (shared)
 env_module (shared)
 headers_module (shared)
 setenvif_module (shared)
 version_module (shared)
 proxy_module (shared)
 proxy_connect_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_fcgi_module (shared)
 proxy_ajp_module (shared)
 proxy_balancer_module (shared)
 slotmem_shm_module (shared)
 ssl_module (shared)
 http2_module (shared)
 unixd_module (shared)
 status_module (shared)
 autoindex_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 actions_module (shared)
 alias_module (shared)
 rewrite_module (shared)


For production, caching is very good. And here for server development - it is bad. Because I don't see the change right away. After each Ctrl-S in Atom, you have to wait a couple of minutes and only then check the changes. Does anyone know how to disable caching?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex Raven, 2022-02-24
@alexraven

The problem was solved by changing one value in php.ini:
opcache.enable = 0

D
Drno, 2022-02-24
@Drno

close the browser. open on a new one, thereby resetting the vash. of course in incognito mode. It's not about the webserver, it's about the browser.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question