PHP not picking up locales

Terry Lewis terry at
Tue Apr 18 07:37:52 UTC 2006

Hi all,
I have a problem with PHP's setlocale where it cannot set a locale except 
POSIX and C. Running locale -a lists all the available locales as normal and 
I have even written a small C program which uses locale.h and nl_langinfo.h 
and this succeeds without any problem. I have also wrote a small testlocale 
php script which you can find at As 
you can see it fails on everything except POSIX and C. It seems like PHP is 
not looking in the right place for the locales which is rather unusual. I 
have consulted and followed exactly the FreeBSD related comments at I've also asked around in the usual PHP places 
but nobody seems to know what is up.

Permissions on the locale directory all seem fine. PHP has been recently 
installed which is version 5.1.2_1, also Running FreeBSD 6.1 and apache 

I should also note that  I run my own FreeBSD 6.1 RC1 server for development 
and PHP setlocale works just fine on it which makes it all the more puzzling. 
I've simply run out of ideas and was hoping someone could shed some light on 
how to fix this problem.

Thanks for your time.
Terry Lewis

More information about the freebsd-questions mailing list