Apache在setlocale上随机返回false

$s = null;
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
        var_dump(setlocale(LC_ALL, 'es'));
    else            
        if (!($s = setlocale(LC_ALL, 'es_ES'))) {

            if (!($s = setlocale(LC_ALL, 'es_ES.iso88591'))) {
                if (!($s = setlocale(LC_ALL, 'es_DO.utf8'))) {
                    setlocale(LC_ALL, 'spanish');
                }
            }
        }
    var_dump($s);

While trying to show a date using strftime, I encountered that sometimes I got it in English and sometimes in Spanish. Looking for the reason, I found out setlocale call sometimes returns false instead of the locale (which is available) I was trying to set, es_ES. I wrote a test code to try to set other Spanish locales if the previews attempts failed. Any clue on why is this happening?

Locale shown on some refresh Locale shown in some others