PatrickVeenstra

Well-Known Member
Feb 12, 2012
173
7
68
Barcelona
cPanel Access Level
Root Administrator
I'm piping an email to PHP, and the first line of my script (before <?php) is #!/usr/local/bin/php -q but that doesn't seem to silence warnings. The message is still bounced back to the sender. So even though the script runs correctly, the sender thinks the message has been rejected.
How can I find out the correct path?

The message that gets bounced is:

This message was created automatically by mail delivery software.

Code:
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

  pipe to |php cognito.php
    generated by [email protected]

The following text was generated during the delivery attempt:

------ pipe to |php cognito.php
       generated by [email protected] ------

X-Powered-By: PHP/5.6.40
Content-type: text/html; charset=UTF-8
BTW I also tried to edit php.ini adding
error_reporting = E_ERROR | E_PARSE

but that didn't solve the issue either.
 

rbairwell

Well-Known Member
May 28, 2022
97
41
18
Mansfield, Nottingham, UK
cPanel Access Level
Root Administrator
I'm personally surprised at the headers included (X-Powered-By and Content-type) as those imply the script thinks it is running under a webserver. It also references PHP 5.6 also reached end of life and was no longer supported by PHP themselves in December 2018 so I would change your PHP version and update your script(s) if possible for security, safety and speed purposes.

Did you set it up as a forwarder (example) or as a filter (example)?

You should remove the "php " section from the call to the script as - fom the "Add a new forwarder" page under the "Advanced Options->Pipe to a Program", it says:
If the script requires an interpreter such as Perl or PHP, you should omit the /usr/bin/perl or /usr/bin/php portion, Make sure that your script is executable and has the appropriate target at the top of the script.
(my emphasis)