我正在尝试在codeigniter和hostgator中运行follow cron作业
/usr/bin/php /home/username/public_html/index.php cronjob contact martin
Run Code Online (Sandbox Code Playgroud)
但没有任何反应,我收到以下电子邮件:
<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Undefined index: REMOTE_ADDR</p>
<p>Filename: core/Input.php</p>
<p>Line Number: 351</p>
<p>Severity: Warning</p>
<p>Message: Cannot modify header information - headers already sent by (output started at /home/iglesias/public_html/mysite.com/system/core/Exceptions.php:185)</p>
<p>Filename: libraries/Session.php</p>
<p>Line Number: 675</p>
Run Code Online (Sandbox Code Playgroud)
我的控制器如下(只需发送电子邮件进行测试).
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Cronjob extends CI_Controller {
function __construct()
{
parent::__construct();
$this->cron();
}
function cron()
{
if(!$this->input->is_cli_request())
{
die();
}
}
function contact($name)
{
$this->load->library('email');
$config['mailtype'] …Run Code Online (Sandbox Code Playgroud)