shell_exec を介して PHP ページから bash スクリプトを実行すると、奇妙な文字が表示されます
PHPスクリプト
shell_exec('bash /home/username/stage/getpicture.sh "url";
これがbashスクリプトです
..some picture grab scripts..
title=$(php -r "echo urlencode(\"this is a test page\");")
echo "$title"
これが結果です
+ÉÈ,Ö¢DíÔâíÄôTû/!
権限:
Php - echo exec('whoami'); を実行すると それは「ユーザー名」を与える
Apache - 「nobody」として実行
Bash スクリプト - 所有者「ユーザー名」