【问题标题】:Cron job CURL command returns 404 page not foundCron 作业 CURL 命令返回 404 页面未找到
【发布时间】:2014-10-30 09:59:40
【问题描述】:

我已经设置了一个 cron 作业来运行 php 脚本,

/usr/bin/curl http://www.domain.com/folder/script.php

我通过电子邮件找不到 404 页面,

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
104  1982  104  1982    0     0   235k      0 --:--:-- --:--:-- --:--:--  483k


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>404 Not Found</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
        body {
                font-family: Verdana, Arial, Helvetica, sans-serif;
                font-size: 12px;
                background-color:#367E8E;
                scrollbar-base-color: #005B70;
                scrollbar-arrow-color: #F3960B;
                scrollbar-DarkShadow-Color: #000000;
                color: #FFFFFF;
                        margin:0;
        }
        a { color:#021f25; text-decoration:none}
        h1 {
                font-size: 18px;
                color: #FB9802;
                padding-bottom: 10px;
                background-image: url(sys_cpanel/images/bottombody.jpg);
                background-repeat: repeat-x;
                padding:5px 0 10px 15px;
                        margin:0;
        }
        #body-content p {
                padding-left: 25px;
                padding-right: 25px;
                line-height: 18px;
                padding-top: 5px;
                padding-bottom: 5px;
        }
        h2 {
                font-size: 14px;
                font-weight: bold;
                color: #FF9900;
                padding-left: 15px;
        }
    </style>
  </head>
  <body>
    <div id="body-content">
<!-- start content-->

<!--
 instead of REQUEST_URI, we could show absolute URL via:
 http://HTTP_HOST/REQUEST_URI
    but what if its https:// or other protocol?

    SERVER_PORT_SECURE doesn't seem to be used
    SERVER_PORT logic would break if they use alternate ports
-->

<h1>404 Not Found</h1>
<p>The server can not find the requested page:</p>
  <blockquote>
    /folder/script.php (port 80)
  </blockquote>
<p>
    Please forward this error screen to www.domain.com's]
    <a href="mailto:info@on.sg?subject=Error message [] 404 Not Found for /folder/script.php port 80 on Wednesday, 29-Oct-2014 17:34:01 SGT">
    WebMaster</a>.
</p>
<hr />


<!-- end content -->
    </div>
  </body>
</html>

我在几个站点中使用相同的 Cron 作业命令,它们都在工作。 请帮我解决这个问题。

谢谢。

【问题讨论】:

  • 这里有问题吗?

标签: php curl cron


【解决方案1】:

尝试通过浏览器访问http://www.domain.com/folder/script.php,看看结果。

确保它没有显示 404。

【讨论】:

  • 可以通过浏览器访问,没有404错误。
  • 我已经尝试过这样的codecurl domain.com/folder/script.phpcode。收到相同的 404 错误电子邮件。
  • 你试过没有文件夹/script.php吗?
  • 如果您仅获得“curl domain.com”的 404,则服务器可能无法访问该域。
【解决方案2】:

我已经按如下方式设置了 cron 作业并且它正在工作。

/usr/local/bin/php -q /home/btlopsco/public_html/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-04-17
    • 2013-07-24
    • 1970-01-01
    • 2019-09-28
    • 2013-07-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多