Search code examples
phpgettextzend-server

PHP gettext method gives empty response


When using the php gettext method like:

error_reporting(E_ALL);
gettext("string");
//OR
_("string");

The server gives an empty response absolutely no output not even an error. When commenting both methods out the page works like expected.

Firefox: The connection was reset

Chrome: No data received

Safari: {shows empty page}

I'm using: latest Zend Server locally on my Mac with OSX Mavericks (10.9.1). Hope someone can help, I'm trying to fix this for about 2 weeks now and nothing seems to work.


Solution

  • Seems to be that on some systems setlocale() isn't enough.

    https://www.php.net/manual/en/function.gettext.php

    Setting a language isn't enough for some systems and the putenv() should be used to define the current locale.

    The issue was solved when I added:

    putenv('LC_ALL=0');