Skip to content
Advertisement

PHP setlocale() fails in browser but works in cli

When I run this php file from command line, it is working fine. But running in through the browser, it is not working.

I’m running this on a local virtual Vagrant machine. Running Ubuntu Xenial 16.04 LTS x64.

JavaScript

output:

JavaScript

Running the same file in te browser:

JavaScript

I don’t understand why this is happening. I’ve installed the locale.

JavaScript

Advertisement

Answer

After you install new locales you need to restart PHP for the new locales to work. So try restarting PHP.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement