Gettext not working through php-cli, but works in php-apache
You need to check if the bindtextdomain() points the same resource file from php-cli and php-apache. I suggest,
- echo the return value of the bindtextdomain() and see them.
- try to replace "./locale" to absolute path (e.g. "/var/www/yourproject/locale") and see if it works.
You have to reset the environment Variable LANGUAGE:
putenv("LANGUAGE=");
Took me a while to find out.
I don't know how much this is relevant or not but …
I just found a solution to the opposite problem: Gettext not working through php-apache, but working in php-cli.
Also concerned, strftime localization not working through php-apache but working in php-cli (on a Linux Debian buster system).
LANGUAGE environment variable did not help as I do not have such environment variable.
Strangely, I just disabled the perl module in Apache and the problem disappeared.
So maybe some bugs in any Apache module could trigger this kind of problem…