简体   繁体   English

从bash脚本执行php的奇怪字符

[英]Weird characters executing php from bash script

I'm getting weird characters when I'm executing a bash script from a php page via shell_exec 当我通过shell_exec从php页面执行bash脚本时,出现奇怪的字符

Php script PHP脚本

shell_exec('bash /home/username/stage/getpicture.sh "url";

Here is the bash script 这是bash脚本

..some picture grab scripts..

title=$(php -r "echo urlencode(\"this is a test page\");")

echo "$title"

This is the result 这是结果

+ÉÈ,Ö¢DíÔâíÄôTû/!

Permissions: 权限:

Php - when I run echo exec('whoami'); php-当我运行echo exec('whoami'); it gives "username" 它给出了“用户名”

Apache - running as "nobody" Apache-以“没人”身份运行

Bash script - owner "username" Bash脚本-所有者“用户名”

Found the answer to this: 找到了答案:

zlib.output_compression = On

at

php.ini

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM