2

I need to display a date in french locale.
A solution is to use setlocale(LC_TIME, 'fr_FR');
But I'm looking to set the locale directly in the configuration of my apache server.
In the /etc/httpd/conf/httpd.conf file, I tried

<VirtualHost *:80>
    ...
    SetEnv LC_TIME 'fr_FR'
</VirtualHost>

without any effect.
In which php or apache configuration file should I define the LC_TIME variable?

2
  • What happens if you read out the locale after setting it through apache? Also, a few people commented on the settings page that you should specify a charset along with the locale. Aug 19, 2014 at 22:15
  • What is it you are trying to change here? Are you trying to change the behaviour of PHP code running from the webserver? If so, how is your PHP integrated with Apache? Are you trying to change the output of an Apache module (such as mod_index)? If its PHP then you need to override intl.default_locale - secure.php.net/manual/en/… see also sitepoint.com/how-to-override-php-configuration-settings
    – symcbean
    Jan 8, 2018 at 20:33

2 Answers 2

0

The httpd.conf file is not typically used to set this parameter. Instead, you will want to edit the /etc/php.ini file and set the timezone in date.timezone:

Europe/Paris

Timezone information can be found on the PHP website http://www.php.net/manual/en/timezones.europe.php

Remember to restart Apache once the changes are made if you are not using PHP-FPM.

3
  • 2
    Unfortunately timezone doesn't manage the locale for date (language for date) neither the LC_TIME variable.
    – Nicolas
    May 26, 2013 at 23:53
  • Thanks for the link, but it doesn't answer to my question. I look for a configuration file to set the locale.
    – Nicolas
    May 27, 2013 at 10:21
0

There is an existing Apache extra module that could solve your issue : https://code.google.com/a/apache-extras.org/p/mod-setlocale/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .