不通过crontab运行的php脚本可以手动运行

时间:2013-06-06 05:38:08

标签: php cron

当我将它运行到浏览器中时,我的脚本工作正常,但是当我使用cron

运行它时,我的脚本无效
require_once('/home/dekh/public_html/track/classes/affiliate.class.php');
require_once('/home/dekh/public_html/track/classes/offer.class.php');
require_once('/home/dekh/public_html/track/classes/merchant.class.php');
require_once('/home/dekh/public_html/track/includes/emails.php');
$mer=new Merchant;
$aff=new Affiliate;
$offer=new Offer;
$message = "Line 1\nLine 2\nLine 3";
$message = wordwrap($message, 70);
mail('my email address', 'My Subject', $message);

我在浏览器中运行时收到邮件

以下是我如何在cron中添加它

wget /home/dekh/public_html/track/includes/cron_for_conversions_mail.php
php /home/dekh/public_html/track/includes/cron_for_conversions_mail.php

我已经尝试了两种方式php / home ..和wget / home ...

请建议谢谢

1 个答案:

答案 0 :(得分:1)

wget url但不是本地文件

就像:

  http://127.0.0.1/cron_for_conversions_mail.php