0

I have these 3 locales installed and generated in my debian VPS

enter image description here

Generating locales is doing this

enter image description here

About webserver, I am using Apache with php-fpm

In my code i do this

echo "\n<!-- locale:\n" ;
var_dump($locale);
echo "  -->\n";
putenv("LC_ALL=$locale");

$_dbg_set_locale = setlocale(LC_ALL, $locale);
echo "\n<!-- esit setLocale:\n" ;
var_dump($_dbg_set_locale);
echo "  -->\n";

And I got that result

<!-- locale:
string(5) "en_GB"
  -->

<!-- esit setLocale:
bool(false)
  -->

As you can see setLocale is failing, returning a boolean false

why setLocale is faling?

realtebo
  • 23,922
  • 37
  • 112
  • 189
  • 1
    Did you restart the webserver process after having these locales installed? – Nico Haase Jun 23 '23 at 08:34
  • Maybe https://stackoverflow.com/questions/19951974/setlocale-php-function-returns-false-even-if-the-locale-is-available-in-the-plat helps? – Nico Haase Jun 23 '23 at 08:35
  • @NicoHaase: no, restarting the webserve is ininfluent [apache in my case,], but It worked restarting the php7.4-fpm-service [because I'm using apache + php fpm service in this vps] Thanks !!! – realtebo Jun 23 '23 at 08:41
  • @NicoHaase: the linked question is not suggesting restarting of php-fpm so I say "no, it doesn't help" – realtebo Jun 23 '23 at 08:41
  • 2
    In that case, you should add an Answer here for future readers, to show what _did_ help in your specific case. And you should edit your question to clarify the circumstances (e.g. use of php-fpm etc). Comments are not searchable, as I'm sure you know :-) – ADyson Jun 23 '23 at 10:36

1 Answers1

1

As suggested in comments, I was simply missing to restart services.

To be precise: because I'm using apache with php-fpm, I must restart ONLY php-fpm because all is related only to php-fpm

Important side note: if you, future googler, are using apache with mod-php, I'm pretty sure this is not enough. Other questions/answers points to need to change something into apache configs and then restart apache2 (of course because there is not php-fpm at all)

realtebo
  • 23,922
  • 37
  • 112
  • 189