5

I am working on a cloud platform and the server is Apache.

In one of the site instances,the php script setlocale(LC_ALL, "en_GB.utf8"); always returns false.

This locale,"en_GB.utf8" can be found available in the platform when I execute locale -a. Also noticed that , setlocale(LC_ALL, 0); returns "C".

Here PHP/Apache seems to be unaware about the underlying platform locales. Can anybody suggest me what could be wrong in case?

Reji Nair
  • 51
  • 1
  • 3

3 Answers3

2

before trying for LC_ALL, try LC_TIME.

setlocale(LC_TIME, "");
setlocale(LC_ALL, "en_GB.utf8")

See if it helps...

Bhavik Shah
  • 2,300
  • 1
  • 17
  • 32
2

You have to reload the apache config in order for php/setlocale to recognize the new locale.

I had the very same problem (locale was installed and available on the platform) but setlocale did return false until I reloaded the apache config with service apache2 reload.

Michael Osl
  • 2,720
  • 1
  • 21
  • 36
0
setlocale(LC_ALL, NULL)
setlocale(LC_ALL, "en_GB.UTF-8")

... did it for me.

caw
  • 30,999
  • 61
  • 181
  • 291