• Uncategorized

About php : Cron-Job-for-php-file-is-not-working-on-some-file

Question Detail

I was setting up a crop job to run the PHP script to send emails from the database.

*/1 * * * * php -q /home/kabilan/cs2062/Project/Master/CS2062/PHP/PHPMailer/cron.php

This is the task command I set in crontab. I’m quite sure that there is no mistake in this because I tried it with some other random scripts which don’t involve in database or any complex code.

cron.php :

require_once '../Result/Database.php';
require_once 'Mail.php';

$mailDatabase = Database::getdb();
$mailList = $mailDatabase->getMailUser();

foreach ($mailList as $mailDetail) {
   $email = $mailDetail[0];
   ...
   ...

When I try to run this script manually, it works perfectly fine but the cron task doesn’t seem to do anything here. What might be the problem here? And also suggest, if there are any way to see the result of a cron task like this.

Question Answer

No answer for now.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.