Answer the question
In order to leave comments, you need to log in
Why doesn't Apache see changes in files (not PHP files)?
Good afternoon. I will try to describe the conditions of the problem in as much detail as possible.
There is a machine running licensed Windows 8.1
. VirtualBox 4.3.26 is installed on it
. VirtualBox has a console version of Opensuse 13.2 with a raised LAMP server
. Opensuse has a /srv/www/htdocs/ folder that Apache2 looks into.
There are several virtual hosts:
/srv/www/ htdocs/vhosts/host1
/srv/www/htdocs/vhosts/host2
/srv/www/htdocs/vhosts/host3
VirtualBox has a static IP address and in the hosts file on windows there are virtual hosts host1, host2, host3 referring to the VirtualBox IP
In the virtual the shared folder D:\\vhosts\ has been added to the machine,
inside which are the host1, host2, host3 folders
the shared folder is connected to the folder /srv/www/htdocs/vhosts/
thus folders from windows are replaced by folders from Linux
/srv/www/htdocs/vhosts/host1 is replaced by the contents of D:\\vhosts\host1\
/srv/www/htdocs/ vhosts/host2 is replaced with the content D:\\vhosts\host2\
/srv/www/htdocs/vhosts/host3 is replaced with the content D:\\vhosts\host3\
Thus, we get that the Lamp server running under OpenSuse accesses files when accessing virtual hosts on Windows.
All folders and files have permissions 777 and the virtual host works fine with files
Now the crux of the problem.
If on the web server (from under Windows) you change any text file, such as CSS or JS, then if you open this file through the vi editor on opensuse, there will be changes, and if you open this file in the browser through apache, then there will be no changes. I say right away that the problem is not in the cache, because even if you clear it or go incognito, everything is the same. As a result, no matter how we change the file, OpenSuse itself sees the changes in the file, but Apache does not see (does not apply to PHP files) if:
do umount /srv/www/htdocs/vhosts/ and mount it again
or
open the file via vi modify it under linux and save
or
open the file via vi do not modify but exit with :wq
or
rename the file, try to load it through the browser, get an error and then rename it back,
then the file is loaded updated, but if you change it again, then all the dances are repeated again.
I broke my whole head what it could be and to be honest I have no idea how to fix it.
In general, in the end I decided to turn to the Internet minds.
apache2ctl -M
Conclusion:Loaded Modules: core_module (static) access_compat_module (static) so_module (static) http_module (static) mpm_prefork_module (static) unixd_module (static) systemd_module (static) authz_host_module (shared) actions_module (shared) alias_module (shared) auth_basic_module (shared) authz_user_module (shared) authn_file_module (shared) authz_groupfile_module (shared) autoindex_module (shared) cgi_module (shared) dir_module (shared) include_module (shared) log_config_module (shared) mime_module (shared) negotiation_module (shared) setenvif_module (shared) status_module (shared) userdir_module (shared) asis_module (shared) rewrite_module (shared) php5_module (shared) authn_core_module (shared) reqtimeout_module (shared) authz_core_module (shared) socache_shmcb_module (shared)
if you download a file in Linux itself via wget, then it will also be unchanged, but strange characters will appear at the end of the file:
if you open it via vi, then there will be ^@^@^@^@
if via notepad++ then some zeros
here are all the services on my machineafter-local.service loaded active exited /etc/init.d/after.local Compatibility apache2.service loaded active running The Apache Webserver cron.service loaded active running Command Scheduler dbus.service loaded active running D-Bus System Message Bus dm-event.service loaded active running Device-mapper event daemon [email protected] loaded active running Getty on tty1 haveged.service loaded active running Entropy Daemon based on the HAVEGE algorithm kmod-static-nodes.service loaded active exited Create list of required static device nodes for the current kernel lvm2-lvmetad.service loaded active running LVM2 metadata daemon mysql.service loaded active running MySQL server nscd.service loaded active running Name Service Cache Daemon ntpd.service loaded active running NTP Server Daemon postfix.service loaded active running Postfix Mail Transport Agent rc-local.service loaded active exited /etc/init.d/boot.local Compatibility sshd.service loaded active running OpenSSH Daemon SuSEfirewall2.service loaded active exited SuSEfirewall2 phase 2 SuSEfirewall2_init.service loaded active exited SuSEfirewall2 phase 1 systemd-journald.service loaded active running Journal Service systemd-logind.service loaded active running Login Service systemd-modules-load.service loaded active exited Load Kernel Modules systemd-random-seed.service loaded active exited Load/Save Random Seed systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems systemd-sysctl.service loaded active exited Apply Kernel Variables systemd-tmpfiles-setup-dev.service loaded active exited Create static device nodes in /dev systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and Directories systemd-udev-root-symlink.service loaded active exited Rule generator for /dev/root symlink systemd-udev-settle.service loaded active exited udev Wait for Complete Device Initialization systemd-udev-trigger.service loaded active exited udev Coldplug all Devices systemd-udevd.service loaded active running udev Kernel Device Manager systemd-update-utmp.service loaded active exited Update UTMP about System Reboot/Shutdown systemd-user-sessions.service loaded active exited Permit User Sessions systemd-vconsole-setup.service loaded active exited Setup Virtual Console [email protected] loaded active running User Manager for UID 0 vboxadd.service loaded active exited LSB: VirtualBox Linux Additions kernel modules wicked.service loaded active exited wicked managed network interfaces wickedd-auto4.service loaded active running wicked AutoIPv4 supplicant service wickedd-dhcp4.service loaded active running wicked DHCPv4 supplicant service wickedd-dhcp6.service loaded active running wicked DHCPv6 supplicant service wickedd-nanny.service loaded active running wicked network nanny service wickedd.service loaded active running wicked network management service daemon
It is worth noting that if changes are made in the PHP file, and no matter what, you can simply write pure html, then they are immediately displayed without problems.
In addition, if the file size is less than ~ 260 bytes, then all changes are also instantly passed. If the file is larger than this size then problems are returned.
Another funny fact is that if you make a file less than 260 bytes (by deleting lines) and change it, then, as mentioned above, the changes will appear immediately, but if you return lines after the change or add others, then the old file comes to the browser before any changes.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question