【问题标题】:Setting up cronjob 000webhost设置 cronjob 000webhost
【发布时间】:2013-09-23 17:34:46
【问题描述】:

我正在尝试在 000webhost 服务器上设置一个 cronjob。

这是我使用的 cronjob 的命令行。 它应该每小时刷新一次,但它没有(我设置了一个写我的数据库来检查)

注意:由于某些奇怪的原因,我无法更改“php -f /home/a2902119/”部分。

php -f /home/a2902119/public_html/database/KlassementRefresh.php

这是我要运行的 php 页面。

<?php

// Incudes
require_once '../includes/klassementFetcher.php';

//Clearing the Check Table
$con = mysqli_connect("url","host","pswd","user");

//Database Connection Check
if (mysqli_connect_errno($con)) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    break;
}

// Fetching Klassement
    //H1 - H1P
    klassementFetch("heren1k","http://kovv.mavari.be/xlsRangschikking.aspx?&reeks=H1");

    //H2 - H3P
    klassementFetch("heren2k","http://kovv.mavari.be/xlsRangschikking.aspx?&reeks=H3A");

?>

当我输入 php 页面的链接时,一切正常,所以我很确定 cronjob 的定义有问题。

感谢您帮助我!

【问题讨论】:

标签: php cron


【解决方案1】:

将以下内容复制到一个文件中,保存为cron_caller.php PHP代码:

<?php
file_get_contents('http://night-city.comeze.com/cron.php');
?>

将该文件上传到您的“/public_html/”文件夹中。

接下来,登录 000Webhost.com (http://members.000Webhost.com),为相应的站点选择“转到 cPanel”。

滚动到页面底部,倒数第二个面板,标记为 Advanced,选择 Cron Jobs。

在'php -f /home/a1234567/'旁边放入public_html/cron_caller.php

设置你想要 Cron 激活的时间

然后点击添加

你已经完成了。

【讨论】:

  • 为什么需要 cron_caller.php?为什么不能直接调用cron.php?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-06-30
  • 1970-01-01
  • 1970-01-01
  • 2020-09-23
  • 2020-09-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多