I have followed the exact guide that is provided on the official codeigniter website for running the CLI (command-line interface) tool. https://www.codeigniter.com/userguide2/general/cli.html
My controller is...
<?php
class Tools extends CI_Controller {
public function message($to = 'World')
{
echo "Hello {$to}!".PHP_EOL;
}
} ?>
When I run the following command from my CMD I get the following output (and error) in the command line window:
php index.php tools message
<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>
.....
<h4>A PHP Error was encountered</h4>
<p>Message: Cannot modify header information - headers already sent by (output at C:{systempath}\system\2.1.4\core\Exceptions.php:185)</p>
<p>Filename: libraries/Session.php</p>
<p>Line Number: 675</p>
</div>Hello World!
Can anyone explain why I am getting this problem? I am following the tutorial as per the official Codeigniter CLI tutorial too - any ideas? I am using CodeIgniter 2.1.4 with XAMPP (Windows).
https://github.com/EllisLab/CodeIgniter/issues/1890
Just replace $_SERVER['REMOTE_ADDR'] with $this->server('remote_addr') at the line that generates the notice. - modify /system/core/Input.php line 351
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With