Php uses the default LOCALEC to execute shellechoshell_exec (exportzh_CN.UTF-8; setlocale (LC_ALL, $ locale); putenv (LC_ALL. $ locale); The above class
Php uses the default LOCALE = C to execute shell echo shell_exec ('export LANG = zh_CN.UTF-8 locale cd/home/mydir mycmd 2 otherwise shelli cannot use the zh_CN.UTF-8's Chinese option or parameter $ locale = 'zh _ CN.UTF-8 '; setlocale (LC_ALL, $ locale); putenv ('lc _ ALL = '. $ locale); above
Php uses the default LOCALE = C to execute shell
Echo shell_exec ('export LANG = zh_CN.UTF-8 & locale & cd/home/mydir & mycmd 2> & 1 ');
Otherwise, shelli cannot use the Chinese options or parameters for the zh_CN.UTF-8
$ Locale = 'zh _ CN.UTF-8 '; setlocale (LC_ALL, $ locale); putenv ('lc _ ALL ='. $ locale );
This method is cumbersome.
For path, you can use
Fastcgi_param PATH/usr/local/bin:/usr/bin:/your/path; To pass Environment Variables
References
Http://serverfault.com/questions/418952/setting-path-for-weberver-user
Original article address: environment variables of PHP shell functions. Thank you for sharing them with me.