I try to set the locale from fr_FR to us_US in PHP (php-fpm) with nginX on my raspberry-pi.
Here is my code:
<?php
system('locale -a');
/*
C POSIX en_US.utf8 fr_FR fr_FR.iso88591 fr_FR.iso885915@euro fr_FR.utf8
So the en_US locale is well installed
*/
echo locale_get_default();
/* fr_FR */
echo setlocale(LC_ALL, '0');
/*
LC_CTYPE=fr_FR.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;
LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;
LC_MEASUREMENT=C;LC_IDENTIFICATION=C
*/
var_dump(setlocale(LC_ALL, 'en_US.UTF-8', 'en_US.UTF8'));
/* bool(false) */
var_dump(setlocale(LC_ALL, 'fr_FR.UTF8'));
/* string(10) "fr_FR.UTF8"
useless, but it shows that setlocale works with the already set locale */
?>
I don't understand why setlocale
returns false
.
It seems something doesn't work but I don't manage to find what.
I had the same problem after installing additional locales on debian machine running nginx with php5-fpm
To fix the problem I had to restart php5-fpm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With