I assume that with "on the web" you refer to Apache web server under Linux ...
In this case the reason for setlocale(LC_ALL, 0)
returning C
is as follows:
If you check /etc/apache2/envvars
from your Apache server you will find the following lines:
## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale
As e result a phpinfo()
will produce the following output:

If you modify the lines in /etc/apache2/envvars
as follows ...
## The locale used by some modules like mod_dav
# export LANG=C
## Uncomment the following line to use the system default locale instead:
. /etc/default/locale
and restart Apache. Then Apache will use the locale and language settings from your operating system(you can check them os settings with the locale
command in a terminal). As a result from the change above a phpinfo()
will produce for example the following output on a system with de_CH.UTF-8
locale defined:

But you may still end up having setlocale(LC_ALL, 0)
returning C
or at least some of the LC_
variables being set to C
e.g LC_CTYPE=de_CH.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C"
In order to ensure that PHP uses the locale settings from the OS you have to call setlocale(LC_ALL, "")
.
The manual of setlocale
under https://www.php.net/manual/en/function.setlocale.php states the following:
// If locales is the empty string "", the locale names will be set from
// the values of environment variables with the same names as the above
// categories, or from "LANG".
// On Windows, setlocale(LC_ALL, '') sets the locale names from the
// system's regional/language settings (accessible via Control Panel).
And finally your setlocale(LC_ALL, 0)
returns the value(s) configured on your operating system e.g. de_CH.UTF-8
:-)