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?

Nicolas
  • 387
  • 2
  • 5
  • 12
  • 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. – Daniel Williams Aug 19 '14 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 - https://secure.php.net/manual/en/intl.configuration.php#ini.intl.default-locale see also https://www.sitepoint.com/how-to-override-php-configuration-settings/ – symcbean Jan 08 '18 at 20:33

2 Answers2

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.

0

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

lazzio
  • 306
  • 1
  • 2
  • 11