Welcome Guest, Not a member yet? Register   Sign In
Cron job returns "Undefined index: REQUEST_METHOD"
#6

(This post was last modified: 03-20-2019, 11:48 AM by anturom. Edit Reason: corrected URL )

@php_rocs,

Yes, to be more accurate, on Windows I can run this job successfully from the command line manually (not actually as a cron), like this:

Code:
php index.php cronjobs statistics

From the log on the Linux server where I get the problem I can now see that it falls back for some reason to the default controller, namely:

Code:
DEBUG - 2019-03-20 19:32:01 --> UTF-8 Support Enabled
DEBUG - 2019-03-20 19:32:01 --> No URI present. Default controller set.
DEBUG - 2019-03-20 19:32:01 --> Global POST, GET and COOKIE data sanitized
ERROR - 2019-03-20 19:32:01 --> Severity: Notice --> Undefined index: REQUEST_METHOD /home/.../sandbox.mydomain.com/system/core/Security.php 211
DEBUG - 2019-03-20 19:32:01 --> Session: "sess_save_path" is empty; using "session.save_path" value from php.ini.
ERROR - 2019-03-20 19:32:01 --> Severity: Warning --> session_start(): Cannot send session cookie - headers already sent /home/.../.../system/libraries/Session/Session.php 143
ERROR - 2019-03-20 19:32:01 --> Severity: Warning --> session_start(): Cannot send session cache limiter - headers already sent /home/.../.../system/libraries/Session/Session.php 143
DEBUG - 2019-03-20 19:32:01 --> Total execution time: 0.1314

I've double checked of course that the path to index.php is correct in my cron job. Maybe it's worth pointing out that the server directory where index.php lives is not public_html, but a directory parallel to public_html. Also, the directory name contains dots, like "my.subdomain.com", if that matters. So basically the structure is:

Code:
dir
  public_html
      some non-CI website
  sandbox.domain.com (CI Home)
      application
      system
      ....
      index.php

The route http://sandbox.mydomain.com/cronjobs/statistics correctly returns 401 when accessed directly from the browser.

I've also tried disabling CSRF protection completely just to be able to narrow down the issue, but that didn't help...
Reply


Messages In This Thread
RE: Cron job returns "Undefined index: REQUEST_METHOD" - by anturom - 03-20-2019, 11:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB