后缀管道失败,命令输出:无法打开输入文件:example@yahoo.com"


Postfix pipe fails with "Command output: Could not open input file: example@yahoo.com"

我今天已经在网上搜索了3-4个小时,没有运气,所以伙计们,我很感激你们的帮助。

我设置了一个后缀管道到PHP文件,当检查/var/log/maillog时,看起来管道想要工作,但我得到这个错误:

Aug  7 20:23:15 u18320568 postfix/pipe[23495]: 483F023D88: to=<email_route@localhost.localdomain>, relay=email_route, delay=0.16, delays=0.07/0.01/0/0.07, dsn=5.3.0, status=bounced (Command died with status 1: "/var/www/vhosts/example.com/dev.example.com/library/parse.php". Command output: Could not open input file: example@yahoo.com )

我的parse。php就是这样的

#!/usr/bin/php -q
<?php
$f = fopen("php://stdin", "r")
mail('me@gmail.com','Reasons','This: <br><br>'.$f)
?>

我试着从顶行删除-q(并验证PHP实际上在那里),我得到:

Aug  7 20:20:27 u18320568 postfix/pipe[22971]: 5673C23D84: to=<email_route@localhost.localdomain>, relay=email_route, delay=0.1, delays=0.07/0/0/0.03, dsn=4.3.0, status=deferred (temporary failure. Command output: pipe: fatal: pipe_command: execvp /var/www/vhosts/example.com/dev.example.com/library/parse.php: No such file or directory )

有谁在找点子吗?

好吧,原来是在notepad++中完成的代码(我猜不是在unix编辑器中)。我必须使用dos2unix使其正确转换,现在文件在

下执行得很好
#!/usr/bin/php -q
我在这里找到了我的答案https://askubuntu.com/questions/239927/usr-bin-php-sometimes-not-working-on-12-10-server