Kita mungkin pernah mengalami error "A PHP Error was encountered" saat saat menjalankan script PHP menggunakan CodeIgniter CLI (command-line interface) melalui command line windows (CMD)
Untuk mengatasi hal ini, caranya mudah sekali, cukup ganti $_SERVER['REMOTE_ADDR'] dengan $this->server('remote_addr') pada baris script 352 (sesuai pesan error yang muncul) file "Input.php" (lokasi file ada di path: /system/core/Input.php)
File Input.php baris 352 (sebelum dimodifikasi)
File Input.php baris 352 (setelah dimodifikasi)
Semoga bermanfaat. ;-)
<div>
<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: 352</p>
</div><div>
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: Cannot modify header information - headers already sent by (output started at d:\xampp\htdocs\projects\ci\system\core\Exceptions.php:186)</p>
<p>Filename: libraries/Session.php</p>
<p>Line Number: 689</p>
</div>
<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: 352</p>
</div><div>
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: Cannot modify header information - headers already sent by (output started at d:\xampp\htdocs\projects\ci\system\core\Exceptions.php:186)</p>
<p>Filename: libraries/Session.php</p>
<p>Line Number: 689</p>
</div>
Untuk mengatasi hal ini, caranya mudah sekali, cukup ganti $_SERVER['REMOTE_ADDR'] dengan $this->server('remote_addr') pada baris script 352 (sesuai pesan error yang muncul) file "Input.php" (lokasi file ada di path: /system/core/Input.php)
File Input.php baris 352 (sebelum dimodifikasi)
File Input.php baris 352 (setelah dimodifikasi)
Semoga bermanfaat. ;-)
PHP Error encountered when running Command Line using CodeIgniter 2.xx
By Unknown →
Saturday, March 14, 2015
Kita mungkin pernah mengalami error " A PHP Error was encountered " saat saat menjalankan script PHP menggunakan CodeIgniter CLI ...
[Baca Selengkapnya]