简体   繁体   English

CPanel 电子邮件管道到 PHP

[英]CPanel Email Piping to PHP

I have created a pipe script in CPanel and have placed the hashbang: #!/usr/bin/php -q at the beginning of my script.我在 CPanel 中创建了一个管道脚本,并将 hashbang: #!/usr/bin/php -q放在脚本的开头。 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?你是如何在 CPanel 中添加管道的?

If you follow this guide: http://www.phpshare.org/articles/Piping-Incoming-Mail-with-PHP.html如果您遵循本指南: http : //www.phpshare.org/articles/Piping-Incoming-Mail-with-PHP.html

It says to add the following into CPanel:它说将以下内容添加到 CPanel 中:

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

Did you ALSO include the -q flag in CPanel as that guide describes?您是否还按照该指南的描述在 CPanel 中包含了 -q 标志?

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).如果您的 php 脚本因任何原因失败(在这种情况下是魔术引号错误),您的电子邮件将被拒绝(即使您可能已经在脚本中处理了电子邮件)。 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 ie 5.2.x to 5.3.我想你最近一定升级了你的服务器 php 版本,即 5.2.x 到 5.3。

PHP 5.3 doesn't support magic_quotes_gpc . PHP 5.3 不支持magic_quotes_gpc

So comment out or remove that line in php.ini.因此,在 php.ini 中注释掉或删除该行。 On cPanel server the path of php.ini is /usr/local/lib/php.ini cPanel服务器上php.ini的路径是/usr/local/lib/php.ini

For commenting you should use ;对于评论,您应该使用; . .

; magic_quotes_gpc = on

I had this problem and i found the answer herehttp://forums.kayako.com/threads/very-odd-piping-problem.11954/我遇到了这个问题,我在这里找到了答案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 :解决方案是在#!/usr/bin/php -q<?php之间只留一个空格:

Wrong way:错误的方法:

#!/usr/bin/php -q

<?php

Right way:正确的方法:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM