虽然在PHP脚本中无法运行的循环在Crontab中运行

I have a php script running as a crontab job.

When I run the file in a browser, the loops executes perfectly but when running in crontab is only executes the first iteration with no output errors.

Any ideas why? I utterly stumped!!!.

the crontab entry: /usr/bin/php /home/XXX/public_html/directory/cron/cron.php 2>&1 >> /home/XXX/public_html/directory/cron/script_output.log | mail -s "Cronjob PSTART Daily" me@XXX.com

PHP:

<?php
$members = new WA_MySQLi_RS("members", $alpha, 0);
$members->setQuery("SELECT

        registration.*,

        child_base_smqf.child_base_smqf_id,
        child_base_smqf.child_base_smqf_uid,
        child_base_smqf.child_base_smqf_open_timestamp,
        child_base_smqf.child_base_smqf_close_timestamp,

        parent_base_smqf.parent_base_smqf_id,
        parent_base_smqf.parent_base_smqf_uid,
        parent_base_smqf.parent_base_smqf_open_timestamp,
        parent_base_smqf.parent_base_smqf_close_timestamp

        FROM registration
        LEFT JOIN child_base_smqf ON registration.rego_parent_uid = child_base_smqf.child_base_smqf_uid
        LEFT JOIN parent_base_smqf ON registration.rego_parent_uid = parent_base_smqf.parent_base_smqf_uid

        WHERE
        registration.rego_parent_acc_status != 0 AND # NOT OPTED OUT
        child_base_smqf.child_base_smqf_close_timestamp IS NOT NULL AND # CHILD BASELINE SURVEY HAS BEEN COMPLETED
        parent_base_smqf.parent_base_smqf_close_timestamp IS NULL # PARENT BASELINE SURVEY HAS NOT BEEN COMPLETED

        GROUP BY `rego_parent_uid`
        ORDER BY `rego_id` ASC");

$members->execute();

while (!$members->atEnd()) {

// !DEFINE VARIABLES
    require('cronVariables.php');

    echo $members->getColumnVal("rego_parent_uid") . ' - ' .$members->getColumnVal("rego_parent_fname") . " STAMP - " . $members->getColumnVal("child_base_smqf_close_timestamp") . " baseline email reminders - " . $parent_base_surveyReminderTrigger . "<br>";

    require('parentBaseReminderEmails.php');

    $members->moveNext();
?>

never got to the bottom of this issue but fixed it by running the url via curl rather than running the php script directly from the php:

/usr/bin/curl -u uname:password --silent --compressed http://www.domain.net/dir/cron/cron.php