Error Reporting Off In Codeigniter
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to configure Codeigniter to report all errors? up vote 7 down vote favorite 1 I had a line - $autoload['libraries'] = array('database');, in CI's autoload.php. Because of this I was getting a blank page. When I removed the 'database', option then I started getting the output. Now my question is not how to configure the database, but how to configure CI to speak its mind. When 'database' was enabled all I got was a complete blank page. No error in php log, no error in Apache log, no error in CI log. In PHP I have set E_ALL. In my CI config I have set log_threshold to 4, i.e. all messages should be logged. What more do I need to do? php codeigniter php-5.3 share|improve this question asked Sep 10 '11 at 7:52 AppleGrew 3,194114487 Could you give the output of phpinfo() inside of your CI-Program? What does trigger_error('test', E_USER_NOTICE) give you? –Lars Sep 10 '11 at 8:17 @Lars Can you please let me know the exact section of phpinfo you want since, it outputs a really long list which I think cannot be posted here. BTW the output the tigger_error is A PHP Error was encountered, Severity: User Notice, Message: test, Filename: controllers/welcome.php, Line Number: 22. This came up in the browser window. In CI logs too it was logged as ERROR - 2011-09-10 13:49:21 --> Severity: User Notice --> test C:\....\lib\codeigniter\application\aceinvite\controllers\welcome.php 22. –AppleGrew Sep 10 '11 at 8:22 I just wanted to make sure, that the error-settings are correct (which is proven by the trigger_error). It may be possible, that the autoloader does not throw any error messages or exceptions. You could still get lucky defining your own error handler, but I guess it will not help. Maybe someone else has an idea (beside debugging the autoload.php that is) - good luck! :) –Lars Sep 10 '11 at 11:59 This helped me, try it: stackoverflow.com/questions/9587413/… –admirm Feb 6 '13 at 18:12 I found this solution: stackoverflow.com/questions/9587413/… It worked for me. –a
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How can I suppress a notice error in codeigniter? http://stackoverflow.com/questions/7370391/how-to-configure-codeigniter-to-report-all-errors up vote 1 down vote favorite I want to suppress notices in the codeigniter error log during a certain cronjob. I've tried using the @ in front of the line, but it still prints the notice in the log: This is the row that is generating the notice: @$resultarray[1][2]++; The notice: ... Severity: Notice --> Undefined offset: 1 ... What am I doing wrong here? (I'm using it http://stackoverflow.com/questions/23214961/how-can-i-suppress-a-notice-error-in-codeigniter well overthought, so please no messages claiming not to use @, thanks :) ) php codeigniter share|improve this question asked Apr 22 '14 at 8:58 Pim 828616 1 check with empty() or isset() if(isset($resultarray[1][2])) $resultarray[1][2]++ –Rakesh Sharma Apr 22 '14 at 9:03 1 You can set error_reporting(0); on your top of that file to turn off all the errors for that particular file, but I will suggest you rather find the proper solution for the error and notices you getting. –Rikesh Apr 22 '14 at 9:04 4 It is royally stupid to not fix this. Just ignoring it is not a solution, and it will cause problems... that you may never know about, or if you do, have a very hard time fixing later on. –Sverri M. Olsen Apr 22 '14 at 9:10 @Rakesh Sharma Of course I can fix it with those kinds of checks, and I might, but for now I am curious why it does not work. –Pim Apr 22 '14 at 11:04 @Rikesh: I am intererested in finding out why the @ sign in front of the line does not work. –Pim Apr 22 '14 at 11:05 | show
Chart Model-View-Controller Architectural Goals Tutorial Static pages News section Create news items Conclusion Contributing to CodeIgniter Writing CodeIgniter Documentation Developer's Certificate of Origin 1.1 General Topics CodeIgniter URLs https://www.codeigniter.com/user_guide/general/errors.html Controllers Reserved Names Views Models Helpers Using CodeIgniter Libraries Creating Libraries http://www.joshuawinn.com/launching-your-codeigniter-site-disable-database-errors/ Using CodeIgniter Drivers Creating Drivers Creating Core System Classes Creating Ancillary Classes Hooks - Extending the Framework Core Auto-loading Resources Common Functions Compatibility Functions URI Routing Error Handling Caching Profiling Your Application Running via the CLI Managing your Applications Handling Multiple Environments Alternate error reporting PHP Syntax for View Files Security PHP Style Guide Libraries Benchmarking Class Caching Driver Calendaring Class Shopping Cart Class Config Class Email Class Encrypt Class Encryption Library File Uploading Class Form Validation FTP Class Image Manipulation Class Input Class Javascript Class Language Class Loader Class Migrations Class Output Class Pagination Class Template Parser Class error reporting off Security Class Session Library HTML Table Class Trackback Class Typography Class Unit Testing Class URI Class User Agent Class XML-RPC and XML-RPC Server Classes Zip Encoding Class Database Reference Quick Start: Usage Examples Database Configuration Connecting to a Database Running Queries Generating Query Results Query Helper Functions Query Builder Class Transactions Getting MetaData Custom Function Calls Query Caching Database Manipulation with Database Forge Database Utilities Class Database Driver Reference Helpers Array Helper CAPTCHA Helper Cookie Helper Date Helper Directory Helper Download Helper Email Helper File Helper Form Helper HTML Helper Inflector Helper Language Helper Number Helper Path Helper Security Helper Smiley Helper String Helper Text Helper Typography Helper URL Helper XML Helper CodeIgniter Welcome to CodeIgniter Installation Instructions Downloading CodeIgniter Installation Instructions Upgrading From a Previous Version Troubleshooting CodeIgniter Overview Getting Started CodeIgniter at a Glance Supported Features Application Flow Chart Model-View-Controller Architectural Goals Tutorial Static pages News section Create news items Conclusion Contributing to CodeIgniter Writing CodeIgniter Documentation Dev
Tutorials & Guides | Tagged: CodeIgniter, PHP, Security Turning off error reporting is often mentioned as a standard security precaution when switching to a production environment. After all, you don't want those precious database table and field names out in the open, for sneaky little hobbitses to view. If someone is rummaging through your site, trying to find vulnerabilities, this severely limits the information they have at their disposal. This of course falls into security-through-obscurity, which isn't going to fix bad code (see the last section below for more about designing code to fail gracefully). It merely fogs the windows to your infrastructure a little. Hackers sometime search Google for pages that have been indexed with MySQL errors on them. They are like a giant red flags, waving boldly in the wind, that read ‘Possible Vulnerability Here'; While a folded ‘On Vacation!' note sits atop the webmaster's chair. Plus, from a visual rather than a security standpoint, who wants to see a big ol' nasty MySQL error when something goes wrong? Alright, you know it's a good idea already. Your CodeIgniter site is launched or is on the verge of doing so, but how do you turn off the errors? There are three Codeigniter files that need to be modified: 1. Turn off PHP Errors with error_reporting(0) In the root directory of your CodeIgniter install, there is an index.php file. The first option in there is ‘PHP ERROR REPORTING LEVEL'. Set it to zero: error_reporting(0); CodeIgniter version 2.0.1 and above have an environment constant in the index.php file as well. Setting this to "production" will disable all PHP error output. Read more about this on the Codeigniter User Guide page on Security and on Handling Environments. 2. Turn off Database Errors in Config The PHP errors are off, but any MySQL errors are still going to show. Turn these off in the /config/database.php file. Set the db_debug option to false: $db['default']['db_debug'] = FALSE; 3. Adjust Error Logging Threshold The /config/config.php file has a log threshold option. It states "For a live site you'll usually only enable Errors