开发者

CPanel Email Piping to PHP

开发者 https://www.devze.com 2023-01-12 11:44 出处:网络
I have created a pipe script in CPanel and have placed the hashbang:#!/usr/bin/php -q at the beginning of my script. The script does run and places a log of the email into a table in my DB as it shoul

I have created a pipe script in CPanel and have placed the hashbang:#!/usr/bin/php -q at the beginning of my script. The script does run and places a log of the email into a table in my DB as it should.

But...It sends an email back claiming that the email did not go through and appears as...

This message was created automatically by mail delivery software.

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 |/home/xxxxx/xxxxx.php
   generated by 开发者_如何学运维support@xxxxxxx.net

The following text was generated during the delivery attempt:

------ pipe to |/home/xxxxxx/xxxx.php
      generated by support@xxxxxxxxx.net ------

PHP Deprecated:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in Unknown on line 0
<br />
<b>Deprecated</b>:  Directive 'magic_quotes_gpc' is deprecated in PHP 5.3 and greater in <b>Unknown</b> on line <b>0</b><br />

I have removed all private information but nothing that is relevant to my issue.

What could be my issue?


How did you add the pipe in CPanel?

If you follow this guide: http://www.phpshare.org/articles/Piping-Incoming-Mail-with-PHP.html

It says to add the following into CPanel:

|php -q /home/phpshare/public_html/handler.php

Did you ALSO include the -q flag in CPanel as that guide describes?


if your php script fails for any reason (in this case the magic quotes error) your email gets rejected (even though you may have processed the email in your script). The system "assumes" that if a script error occured then the message delivery failed.

As others have said, fix the magic quotes problem...


I think you must have upgraded your servers php version recently i.e 5.2.x to 5.3.

PHP 5.3 doesn't support magic_quotes_gpc.

So comment out or remove that line in php.ini. On cPanel server the path of php.ini is /usr/local/lib/php.ini

For commenting you should use ;.

; magic_quotes_gpc = on


I had this problem and i found the answer here http://forums.kayako.com/threads/very-odd-piping-problem.11954/

The solution is to leave only one space break between #!/usr/bin/php -q and <?php:

Wrong way:

#!/usr/bin/php -q

<?php

Right way:

#!/usr/bin/php -q
<?php
0

精彩评论

暂无评论...
验证码 换一张
取 消