Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php cron info发送了一封奇怪的电子邮件_Php_Email_Cron - Fatal编程技术网

Php cron info发送了一封奇怪的电子邮件

Php cron info发送了一封奇怪的电子邮件,php,email,cron,Php,Email,Cron,我从我服务器的cron信息中收到了这封电子邮件 ‘clitsOrror’在共享对象中有不同的大小,考虑重新链接 这是什么 这个cron作业只是一个简单的电子邮件脚本 这是剧本 include("../admin/connect.php"); require("../class.phpmailer.php"); $from = "Me@me.com"; $fromname = "Me"; $mail = new PHPMailer(true); //New instance, wit

我从我服务器的cron信息中收到了这封电子邮件

‘clitsOrror’在共享对象中有不同的大小,考虑重新链接

这是什么

这个cron作业只是一个简单的电子邮件脚本

这是剧本

include("../admin/connect.php"); 
require("../class.phpmailer.php");

$from = "Me@me.com";
$fromname = "Me";

    $mail = new PHPMailer(true); //New instance, with exceptions enabled
$mail->IsSMTP();                           // tell the class to use SMTP
    $mail->SMTPAuth   = true;                  // enable SMTP authentication
    $mail->Port       = 587;                    // set the SMTP server port
    $mail->Host       = "smtp.gmail.com"; // SMTP server
    $mail->Username   = "********";     // SMTP server username
    $mail->Password   = "********";            // SMTP server password
    $mail->SMTPSecure = "tls"; // sets the prefix to the server
    $mail->IsSendmail();  // tell the class to use Sendmail


    $mail->From       = $from;
    $mail->FromName   = $fromname;

    $mail->Subject  = "Hi";

$edate = date("Y-m-d");
$query  = "SELECT * FROM `set` WHERE expire = '$edate'";
$result = MYSQL_QUERY($query);

while ($row = mysql_fetch_array ($result))
{

    $body .= "<pr>Hello<br /><br />";
$body .= "Hope everything is ok,<br />";

    $text_body  = "To view the message, please use an HTML compatible email viewer!";

    $mail->Body    = $body;
    $mail->AltBody = $text_body;
    $mail->AddAddress($row['email']);


    $mail->Send();
    $mail->ClearAddresses();

}

谢谢你正在运行的东西需要一个变量结构或数组,可能有一个特定的大小N。不幸的是,提供该变量值的共享库有一个不同的大小M。请求“重新链接”可能有点幼稚;这可能意味着使用新的头重新编译和重新链接,等等

因此,脚本中使用的一些程序需要重建

根据经修正的问题:

我想这可能是个问题。需要担心的一件事是,cron运行的PHP是否具有正确的环境—cron没有设置太多的环境。它可以执行一个PHP,但试图从另一个PHP加载库,或者类似的奇怪行为

我对运行cron作业的标准建议是始终运行shell脚本,在运行“real”任务之前,如果需要,可以设置环境。这也使得调试更容易

{
...environment setting...
env   # debug only
pwd   # debug only
date  # debug only
...exec the real program...
} >/tmp/log.$$ 2>&1

我用我运行的脚本编辑了我的问题。你认为这有什么问题吗?thx@Ahmetvardar,当您通过cli或apache运行脚本时会发生什么…只是没有cron位的脚本。thx Jonathan,@Ronald,没有cron,它正常工作。这真的很奇怪:S@Ahmet:如果某些东西在没有cron的情况下正常工作,而在使用cron时异常工作,则由于环境的不同,答案可能是100次中的99次。因此,上面的例子。如果需要,您可以以不同的方式执行调试重定向-例如,捕获所示的调试信息,但在{…}I/O重定向之外执行命令。