K
K
karpo5182020-04-03 21:15:33
PHP
karpo518, 2020-04-03 21:15:33

How to set LC_ALL in Ubuntu for user www-data?

A whole bunch of things have been done. The locales are defined in the following files:

/root/.bashrc
/home/user1/.bashrc
/var/www/.bashrc
/etc/default/locale

The server has been rebooted. Executed a bunch of other commands:

sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8


The only thing. I did not try to register in /et/environment. They say it's dangerous.

The variable is required to run bash commands using PHP. It is not desirable to prescribe in each application using the php-function setlocale in principle. I want to configure once for all users.

echo shell_exec('locale') returns:

LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=


How to fix?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gregory, 2020-04-04
@G_r_i_g_a

Here's your standard warning:

The LC_ALL variable overrides all LC_* variables, including LANG, with its value, whether they are set or not.
The LC_ALL variable is the only one of all LC_ variables that cannot be set in /etc/locale.conf: it is only for troubleshooting purposes.

But if you still want to set it, then write it in /etc/environment: LC_ALL=
Well, then update the variables or restart the server. Just keep in mind that the variable will be set for all users.
By the way, checked, it works for one user. You probably forgot export, write in .bashrc:export LC_ALL=локаль

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question