Prashant
Prashant

Reputation: 27

php script not running via crontab runs fine manually

My script is working fine when I run it into browser but not working when I run it using 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);

I get mail when I run it in browser

Here how I've added it in 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

I've tried it both ways php /home.. and wget /home...

Please suggest thanks

Upvotes: 0

Views: 287

Answers (1)

eric_zyh
eric_zyh

Reputation: 176

wget url but not a local file

just like:

  http://127.0.0.1/cron_for_conversions_mail.php

Upvotes: 1

Related Questions