• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue Problem with setlocale [PHP 7.4]

Azurel

Silver Pleskian
On my new CentOS 8.2 server was only englisch langpack installed.
I called
# yum install -y langpacks-de glibc-all-langpacks
After this
# locale -a | wc -l
865

I have two subscriptions on my plesk obsidian server. I use only php 7.4.9 with FPM application served by Apache. I have put a single php-file to each domain with this code
PHP:
<?php
var_dump(locale_get_default());

echo '<br><br>UTF-8<br>';
var_dump(setlocale(LC_ALL, 'de_DE.UTF-8'));
echo '<br>'.strftime('%b', mktime(0,0,1,5,1,2020));

echo '<br><br>utf8<br>';
var_dump(setlocale(LC_ALL, 'de_DE.utf8'));
echo '<br>'.strftime('%b', mktime(0,0,1,5,1,2020));

Now it gets weird.

in SubscriptionA with DomainA.COM shows always this correct output:
string(11) "en_US_POSIX"

UTF-8
string(11) "de_DE.UTF-8"
Mai

utf8
string(10) "de_DE.utf8"
Mai

SubscriptionB all domains point to same vhost folder.
In SubscriptionB with DomainB.DE shows a different output. Here "UTF-8" is always FALSE and locale_get_default() changes ~50% from "en_US_POSIX" to "de_DE".
In SubscriptionB with DomainC.COM; here "UTF-8" is working, but locale_get_default() changes ~50% from "en_US_POSIX" to "en_US".

"utf8" is in all domains always correct.

What happen here and why?

1. How is it possible that "UTF-8" does not work for only one domain?
2. Why does the "locale_get_default" in domains change to a different value every few calls?

UPDATE:
I clicked in plesk on save-button for "PHP Settings for domainB.DE" and this issue is gone. Was here a migrate issue?
 
Last edited:
Back
Top