Although many questions on SO already relate to this, they're A) pretty old and B) I felt that it's better to ask about this here, as it seems to be related to some server-level, and not programming-level, cache.
The problem is that our server, using Apache and PHP, uses gettext
with the .po and .mo files, in the native confoguration, that is using bindtextdomain
with the folder structure:
translations/
en_GB/
LC_MESSAGES/
mydomain.mo
fr_FR/
LC_MESSAGES/
mydomain.mo
to for example load english and french translations for the mydomain
text domain. Loading the translations to the server and using them for the first time with PHP's native gettext()
, _()
, etc. functions works, all good. The problem is that, when we update our .mo files with new translations, these updates are not applied. Several sources state that the apache server has to be restarted to flush the gettext cache:
etc.
Is it still true to the current date that gettext caches of a Apache-PHP application can exclusively be flushed by restarting the apache server? Is there no other approach to do this? Consider that we have a managed VPS-hosting, hence no root access & we're not allowed to restart Apache on our server.
I know that you could theoretically implement a logic which adds timestamps of your modifications to the domain name mydomain
, but according to this post here, "changing the domain to get rid of the cache problem [...] will create lots of out-of-date cache in memory.", so I'm wondering if that approach is actually viable.
PHP is running as php-cgi on our Apache server. I've also noted now that the LC_MESSAGES
folders contain a .nfs....
file which I am seemingly unable to delete (if I delete it, it simply reappears). Could this indicate that my .mo
files have been reopened / accessed by some app, not closed, and thus cause some kind of unwanted translation cache?
.nfs...
files in myLC_MESSAGES
are? People say that, if PHP is running as Apache Module, you will have gettext translations cached until you restart the server. Yet this does not seem to be accurate, as I have made tests with a VPS with root access. There, simply uploading the new.mo
file works, no apache restart needed, and the code to load the text domains is exactly the same. But there are none of thesenfs
files..mo
files when I try to update them with new contents. I'm feeling that these.nfs
files must be causing the issue with the wrongly retrieved gettext translations. Thanks! (And if you know any known issues in that context, feel free to let me know:))