Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP locale configuration in php.ini

Tags:

php

locale

Can a default locale value be placed in file php.ini or .htaccess?

The equivalent of the PHP function

setlocale(LC_MONETARY, 'it_IT');

for example.

like image 779
johnlemon Avatar asked Feb 22 '11 07:02

johnlemon


People also ask

What is locale PHP?

A "Locale" is an identifier used to get language, culture, or regionally-specific behavior from an API. PHP locales are organized and identified the same way that the CLDR locales used by ICU (and many vendors of Unix-like operating systems, the Mac, Java, and so forth) use.

Where can I find PHP INI file?

ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.


2 Answers

It can. Take a look at intl.default_locale.

like image 187
David Kuridža Avatar answered Sep 24 '22 01:09

David Kuridža


There's nothing in the php.ini file to help you. But as an alternative you could try setting environment variables from file .htaccess:

SetEnv   LC_ALL  it_IT.UTF-8

But these settings only take effect for the CGI and FastCGI versions of PHP at best, not for the usual mod_php installation.

like image 39
mario Avatar answered Sep 22 '22 01:09

mario