Php Hide Error
Contents |
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 php.ini error reporting more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags php error_reporting Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, php display_errors helping each other. Join them; it only takes a minute: Sign up php hide ALL errors up vote 11 down vote favorite 5 what are the best practises for hiding all php errors? As I don't want ERRORS
Php Error Types
to show to the user. I've tried using the .htacess by putting the code php_flag display_errors off in there, but it returns me a 500 error. Are there any other methods that will hide all errors? php apache security share|improve this question asked Feb 11 '12 at 18:35 Frank 62941731 php_flag only works if PHP is running as an Apache module. If you're running it via CGI or something, Apache doesn't know anything about that php error reporting not working directive, so it throws an error. –cHao Feb 11 '12 at 18:39 add a comment| 5 Answers 5 active oldest votes up vote 24 down vote to Hide All Errors: error_reporting(0); ini_set('display_errors', 0); to Show All Errors: error_reporting(E_ALL); ini_set('display_errors', 1); share|improve this answer edited May 15 '14 at 11:49 answered Oct 20 '13 at 9:04 Aditya P Bhatt 9,129145985 add a comment| up vote 4 down vote Per the PHP documentation, put this at the top of your php scripts: http://php.net/manual/en/function.error-reporting.php If you do hide your errors, which you should in a live environment, make sure that you are logging any errors somewhere. How to log errors and warnings into a file? Otherwise, things will go wrong and you will have no idea why. share|improve this answer answered Feb 11 '12 at 18:38 john.w 210311 add a comment| up vote 1 down vote In your php file just enter this code: error_reporting(0); This will report no errors to the user. If you somehow want, then just comment this. share|improve this answer answered Feb 11 '12 at 18:38 axiomer 1,9191025 This still reports errors such as Parse error: syntax error –Frank Feb 11 '12 at 18:49 4 Yeah..any error that happens before the script actually starts running (parse errors, syntax errors) won't be hidden by a call that happens after the
Learn Bootstrap Learn Graphics Learn Icons Learn How To JavaScript Learn JavaScript Learn jQuery Learn jQueryMobile Learn AppML Learn AngularJS Learn php display errors off JSON Learn AJAX Server Side Learn SQL Learn PHP Learn ASP
Php Error Message
Web Building Web Templates Web Statistics Web Certificates XML Learn XML Learn XML AJAX Learn XML DOM
Php.ini Hide Errors
Learn XML DTD Learn XML Schema Learn XSLT Learn XPath Learn XQuery × HTML HTML Tag Reference HTML Event Reference HTML Color Reference HTML Attribute Reference HTML http://stackoverflow.com/questions/9242903/php-hide-all-errors Canvas Reference HTML SVG Reference Google Maps Reference CSS CSS Reference CSS Selector Reference W3.CSS Reference Bootstrap Reference Icon Reference JavaScript JavaScript Reference HTML DOM Reference jQuery Reference jQuery Mobile Reference AngularJS Reference XML XML Reference XML Http Reference XSLT Reference XML Schema Reference Charsets HTML Character Sets HTML ASCII HTML ANSI HTML Windows-1252 HTML ISO-8859-1 http://www.w3schools.com/Php/func_error_reporting.asp HTML Symbols HTML UTF-8 Server Side PHP Reference SQL Reference ASP Reference × HTML/CSS HTML Examples CSS Examples W3.CSS Examples Bootstrap Examples JavaScript JavaScript Examples HTML DOM Examples jQuery Examples jQuery Mobile Examples AngularJS Examples AJAX Examples XML XML Examples XSLT Examples XPath Examples XML Schema Examples SVG Examples Server Side PHP Examples ASP Examples Quizzes HTML Quiz CSS Quiz JavaScript Quiz Bootstrap Quiz jQuery Quiz PHP Quiz SQL Quiz XML Quiz × PHP Tutorial PHP HOME PHP Intro PHP Install PHP Syntax PHP Variables PHP Echo / Print PHP Data Types PHP Strings PHP Constants PHP Operators PHP If...Else...Elseif PHP Switch PHP While Loops PHP For Loops PHP Functions PHP Arrays PHP Sorting Arrays PHP Superglobals PHP Forms PHP Form Handling PHP Form Validation PHP Form Required PHP Form URL/E-mail PHP Form Complete PHP Advanced PHP Arrays Multi PHP Date and Time PHP Include PHP File Handling PHP File Open/Read PHP File Create/Write PHP File Upload PHP Cookies PHP Sessions PHP Filters P
plugin/theme developer should know about these so that they may fix them in a future release). PHP warnings and notices are nothing to worry about on a production site most of the time. Some php error of these can even be generated because the developer has to keep compatibility with older versions of WordPress as well as older PHP versions. The solution: If you simply set WP_DEBUG to false in your wp-config.php file you should be fine. php hide error These don’t affect your site in any way. However, the problem is that some times the above does not work. That can happen most times on cheap shared hosts that force displaying PHP warnings and notices. In that case, you can replace this line from your wp-config.php file: define('WP_DEBUG', false); with this: ini_set('log_errors','On'); ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG', false); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false); I hope that helps someone out there! twitter Written by Blog Logo Aristeides Stathopoulos Published 03 Oct 2014 Supported by Proudly published with Jekyll You should subscribe to my feed. All content copyright Aristeides Stathopoulos © 2016All rights reserved. Please enable JavaScript to view the comments powered by Disqus. Image Aristeides Stathopoulos WordPress Developer, Human. Back to Overview