【问题标题】:Cron file working fine in browser but not in commandCron 文件在浏览器中工作正常,但在命令中不工作
【发布时间】:2013-04-28 22:46:39
【问题描述】:

我已经在 hostgator 中配置了 cron 作业。 它从网络浏览器运行得很好,一切正常。 (https://www.site.com/cron.php) 但是 hostgator 中的计划 cron 作业不适用于这些命令中的任何一个...... php /home/用户名/public_html/cron.php 或 php -q /home/username/public_html/cron.php

这是我的 cron.php 文件。你能帮忙吗?

<?php
    require_once ('config_inc.php');


    define('_VALID_MOS_', 1);
    set_time_limit(0);
    error_reporting(E_ALL ^ E_NOTICE);
    ignore_user_abort(true);
    require_once (DOCSPATH . 'includes/eg_cron.php');

    if (running_from_commandline()){
        run_cronfile();
        exit;
    }
    require_once (DOCSPATH . 'includes/setting_inc.php');
    require_once (_EG_LANGUAGE_DIR . $config['language_default']  . "/general.php");
    $cron = new egCron();

    if ($config['cron_investment']) $cron->cron_deposit();
    if ($config['mailqueue_enable'] && $config['cron_mailqueue']) $cron->cron_mailqueue();
    if ($config['cron_automail']) $cron->cron_automail();

    if ($config['expdays'] && $config['cron_expire']) $cron->cron_expire();
    if ($config['cron_pending']) $cron->cron_pending();
    if ($config['cron_stats']) $cron->cron_stats();

    $cron->log_cron("Cron job finished successfully");
?>

【问题讨论】:

    标签: php cron command


    【解决方案1】:

    我们在这里遇到了同样的问题,您可以尝试一下替代方案。 在包含中给出完整的绝对路径而不是相对路径。 尝试使用 php-cgi 而不是 php

    然后享受。

    【讨论】:

      猜你喜欢
      • 2017-05-07
      • 1970-01-01
      • 2019-10-10
      • 2015-11-14
      • 2015-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多