Search code examples
phpsvnlocale

svn locale warning when svn run from PHP


I am getting the following warnings whenever a php page is calling svn command to check a version number:

svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LANG is not set
svn: warning: please check that your locale name is correct

Any idea how to fix this? This is the apache error log (on Mac OS X El Capitan Server) that is throwing this message, I am not in a terminal shell, so the various fixes I have read about those seem not to apply in this case.

Possibly important to note that I am using a newer version of svn that that installed with xtools, it was installed via Macports.


Solution

  • set set LC_ALL to the appropriate locale before executing svn command.

    <?php
    echo shell_exec("export LC_ALL=C;svn --version");