繁体   English   中英

CPanel 电子邮件管道到 PHP

[英]CPanel Email Piping to PHP

我在 CPanel 中创建了一个管道脚本,并将 hashbang: #!/usr/bin/php -q放在脚本的开头。 该脚本确实运行并将电子邮件的日志放入我的数据库中的表中。

但是......它发回一封电子邮件,声称该电子邮件没有通过并显示为......

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 />

我已删除所有私人信息,但没有与我的问题相关的信息。

我的问题可能是什么?

你是如何在 CPanel 中添加管道的?

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

它说将以下内容添加到 CPanel 中:

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

您是否还按照该指南的描述在 CPanel 中包含了 -q 标志?

如果您的 php 脚本因任何原因失败(在这种情况下是魔术引号错误),您的电子邮件将被拒绝(即使您可能已经在脚本中处理了电子邮件)。 系统“假定”如果发生脚本错误,则消息传递失败。

正如其他人所说,修复魔术引号问题......

我想你最近一定升级了你的服务器 php 版本,即 5.2.x 到 5.3。

PHP 5.3 不支持magic_quotes_gpc

因此,在 php.ini 中注释掉或删除该行。 cPanel服务器上php.ini的路径是/usr/local/lib/php.ini

对于评论,您应该使用; .

; magic_quotes_gpc = on

我遇到了这个问题,我在这里找到了答案http://forums.kayako.com/threads/very-odd-piping-problem.11954/

解决方案是在#!/usr/bin/php -q<?php之间只留一个空格:

错误的方法:

#!/usr/bin/php -q

<?php

正确的方法:

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

暂无
暂无

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

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