I'm trying to find out system locale from PHP script on Debian. The way I do:
<?php
$out = shell_exec('locale');
print_r($out);
?>
Result:
LANG=C
LANGUAGE=
LC_CTYPE="C"
LC_NUMERIC="C"
...
But when I write 'locale' command in my system console I get 'right' result:
LANG=ru_RU.UTF-8
LANGUAGE=
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
...
What is the right way to get system locale from PHP script?
Overall purpose: In the request I accept a file path, which can contain cyrillic symbols. Then I need to access files in this directory. So I want to make my php script work with systems which use different locales (e.g. ru_Utf8, Koi8-r).
/etc/default/locale?