0

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

2
  • commonly this is an environment problem. PATH variable, Access rights (which user is running the cron?), certain environment variables like TZ, LOCALE, ... Check the environment when running from console and when running from cron Commented Jun 6, 2013 at 5:41
  • Actually I'm running another cron on same server and everything is same php /home/dekh/public_html/db_backup/back_up_db.php Commented Jun 6, 2013 at 5:44

1 Answer 1

1

wget url but not a local file

just like:

  http://127.0.0.1/cron_for_conversions_mail.php
Sign up to request clarification or add additional context in comments.

1 Comment

I don't know why php php /home/dekh/public_html/track/includes/cron_for_conversions_mail.php is not working but php /home/dekh/public_html/db_backup/back_up_db.php is working for me. But as @eric_zyh suggested to wget the url it worked for me thanks a lot for pointing out what I was doing wrong here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.