Environment Variables of PHPshell Functions

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.