PHP - locale information deleted after PDO connection (DB2)

Is there a reason why PHP loses all local information after connecting to DB2 with PDO?

I always need to set local information again after connecting.

<?PHP //set locale information setlocale( LC_MONETARY,'en_US' ); //print location information print_r(localeconv()); // Array // ( // [decimal_point] => . // [thousands_sep] => // [int_curr_symbol] => USD // [currency_symbol] => $ // [mon_decimal_point] => . // [mon_thousands_sep] => , // ... // ) //************************************************ //create conenction to server $connection= new PDO("odbc:server", 'username', 'password'); //************************************************ //see locale information after creating a connection print_r(localeconv()); // Array // ( // [decimal_point] => . // [thousands_sep] => // [int_curr_symbol] => // [currency_symbol] => // [mon_decimal_point] => // [mon_thousands_sep] => // ... // // ) ?> 
+4
source share
1 answer

If you are on Windows, then there is a common problem that setlocale () is not working. In my case, it switched to the base locale at a random point in the script, while the script was running. I won 7 professional 64-bit. At that time, no other script was running.

0
source

Source: https://habr.com/ru/post/1440115/


All Articles