Different dates on server/locally

Hello
Just another issue concerning dates. In my localhost, my dates works fine in French. On servor, it appears in English, I don’t know how to fix it, and it’s a big problem for me.

I’m using Bastian’s calendar with this config

date_default_timezone_set('Europe/Paris');
    setlocale(LC_ALL, 'fr_FR');
    setlocale (LC_TIME, 'fr_FR.utf8','fra'); 

And in my config.php I did multiple times settings like this :

c::set('locale', array(
  LC_COLLATE  => 'fr_FR.utf8',
  LC_MONETARY => 'fr_FR.utf8',
  LC_NUMERIC  => 'fr_FR.utf8',
  LC_TIME     => 'fr_FR.utf8',
  LC_MESSAGES => 'fr_FR.utf8',
  LC_CTYPE    => 'fr_FRs.utf8',
));
c::set('locale', 'fr_FR.utf8');
c::set('date.handler', 'strftime');
c::set('date.timezone', 'Europe/Paris');

What is very weird is everything works fine locally but not on server

Is the language installed on the server?

Here’s a small guide for Ubuntu/Debian distros. https://help.ubuntu.com/community/Locale

The website is on OVH, and I don’t think OVH needs any language installation. (I didn’t find any documentation about this).
But here is another clue : I have copied/pasted all the files of the site into another OVH server and this time, the site is displayed in french, like it have to be.

I’m a bit lost about this issue, but I’m still supposing it comes from the server. How can I fix it ?

Do you have SSH access to the servers? If I recall correctly, OVH are mostly a dedicated server and VPS provider. If that’s the case, I doubt OVH has documentation on language installation as the method differs between OSes, regardless of the host. By default most Linux distributions have en_US.utf8 and other variants of en installed.

When you use date functions like strftime, PHP gets the month, weekday strings from the server. The server doesn’t know Wednesday is Mercredi unless you have the languages installed.

I actually have access to the SSH. I’ve never done that before, it makes me a little scared. How am I supposed to change to fr_FR.uft8 ? What is the command line to write?

Do you think a <? phpinfo(); ?> file could be usefull ?

What do you get if you type

locale -a

in the command line on the server?

You don’t need to do anything complicated. Assuming you’re on Ubuntu, first think you can do, is connect to the offending server via SSH an use the command:

locale -a

This should list all of the installed languages. Check if fr_FR.utf8 is listed.

If it’s not, you can run:

sudo apt-get install language-pack-fr

to install it.

Yes, when I type locale -a I can see that

french
fr_FR
fr_FR@euro
fr_FR.iso88591
fr_FR.iso885915@euro
fr_FR.utf8

You could try another syntax:

c::set('locale', 'fr_FR.UTF-8');
c::set('locale', 'fr_FR.UTF8');

Doesn’t change anything.:cry:
I tried FR.UTF8, fr_FR.UTF-8, and fr_FR.iso88591 (just trying)

I’m really starting to worry, especially with these possible solutions that do not work.
I assure you I put exactly the same files on another OVH server and that it works in French.

Hm, the website you linked to has English month names?

At least in the sidebar and at the top…

Ok, I see a totally different thing, from my point of view, the month’s name are in French, and the header too.
How can this be possible ?

For example, in the horizontal header ticker, the code is

<?php if($date = param('date')): ?>    
<?php 
            $datefr = strftime("%A %e %B %Y",strtotime($date)); ?> 
            <span class="jourferie">La Tôlerie est fermée ce jour </span><?php echo $datefr ?> <span class="pleinelune">(Les jours de Pleine lune <span class="countpleine"></span>)</span>
            <?php else: ?>
            <span class="jourferie">La Tôlerie est fermée ce jour </span><span class="aujour">AUJOURD’HUI, LE </span><?php   echo strftime('%e %B %Y') ?><span class="pleinelune">(Pleine lune)</span>
            <?php endif ?>

I see the month names in french. What is going on.

FYI: For me they’re displayed in English. Strange!?

http://matiere-revue.com/latolerie/

On top on that, some people reported that they saw the date of June 9 since three days on the home page, while the default today date always worked for me in both URL…

I did a reduced test case with

<?php
setlocale (LC_TIME, 'fr_FR'); 
echo (strftime("%A %d %B")); 
?>

Same issue : I see french date locally, english on server.

Have you also tried several options for this simple test, like

fr_FR.utf8
fr_FR.UTF8
fr_FR.UTF-8

I immediatly did that. You can see mutiple options in the test page, I get everything in English exept on matiere-revue.com/test.php, and on local

Again, for me matiere-revue.com/test.php displays everything in English :confused:

Which OS is installed on those servers?

Edit (14:08): Now it is suddenly in French/German/NL

I have called OVH and my server is mutualized, so I can’t change the OS. Matiere-revue.com and latolerie.fr are running on Linux. You can check every informations you need here

Do you think this is necessarily a server problem?

This is definitely a server settings problem.

By “mutualized” I guess you mean it is shared hosting so that you don’t have root rights?