PHP exec 不返回 awk 输出

PHP exec not returning awk output

我试图通过 PHP 获取以下 awk 命令的输出,但我没有得到任何输出

$time_ref = date("Y-m-d\TH:i:s",strtotime(date('c', (time() - 80)))); //2020-03-29T21:00:30

$s_string = 'awk \'[=11=] > "'.$time_ref.'" && [=11=] ~ "AAA4311A01A404C4E21ABE55"\' /var/log/syslog | tail -1';  

echo shell_exec($s_string);

运行 来自控制台的 awk 直接工作:

pi@raspberrypi:/var/log $ awk '[=12=] > "2020-03-30T10:06:28" && [=12=] ~ "AAA4311A01A404C4E21ABE55"' syslog

2020-03-30T10:07:40.300908+02:00 RadioBridge ESP-RSL: RESULT = {"RfRaw":{"Data":"AAA4311A01A404C4E21ABE55"}}

关于 PHP 为什么它不起作用的任何建议?

There are many solution. 
1) if  you run the PHP file in web, you should set the permission to the awk file. 
2) we should set the path of the "awk"
$PATH = "real path";
putenv("PATH=$PATH");
$_string = "./awk ...."

Thanks.