Hide Notices dan Warning di Codeigniter

php-warningSering banget lupa kalau mau disable notices sama warning di CI.. maklum newbie. Jadi posting saja deh, kali aja bermanfaat buat newbie yang lain, ya minimal buat diri sendiri lah. 😀

– Cara 1: di settingan xampp nya.

D:\xampp\apache\bin\php.ini

error_reporting = E_ALL & ~E_NOTICE

; Print out errors (as a part of the output). For production web sites,
; you’re strongly encouraged to turn this feature off, and use error logging
; instead (see below). Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
display_errors = Off

=====================================================================

– Cara 2: di local/aplikasi nya.

D:\xampp\htdocs\hosting\index.php

if (defined(‘ENVIRONMENT’))
{
switch (ENVIRONMENT)
{
case ‘development’:
//error_reporting(E_ALL);
//error_reporting(E_NOTICE, E_WARNING);
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
ini_set(‘display_errors’, 0);
break;

case ‘testing’:
case ‘production’:
error_reporting(0);
break;

default:
exit(‘The application environment is not set correctly.’);
}
}

Atau lengkapnya.. bisa lihat disini atau disitu.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s