Better Php Error Messages
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 more php mysql error messages about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users
Hide Php Error Messages
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
Enable Php Error Messages
other. Join them; it only takes a minute: Sign up How to get useful error messages in PHP? up vote 364 down vote favorite 162 I find programming in PHP quite frustrating. Quite often I will try and
Php File Upload Error 2
run the script and just get a blank screen back. No error message, just empty screen. The cause might have been a simple syntax error (wrong bracket, missing semicolon), or a failed function call, or something else entirely. It is very difficult to figure out what went wrong. I end up commenting out code, entering "echo" statements everywhere, etc. trying to narrow down the problem. But there surely must be a better way, right?. So, is there php error reporting a way to get PHP to produce useful error message like Java does? Can anyone recommend good PHP debugging tips, tools and techniques? php debugging error-handling share|improve this question edited May 11 '13 at 23:52 hkBattousai 3,63683982 asked May 10 '09 at 9:48 Candidasa 2,92982330 coding.smashingmagazine.com/2011/11/30/… –Alex Jul 15 '12 at 14:54 1 Also see stackoverflow.com/q/1475297/632951 –Pacerier Oct 14 '14 at 9:37 @JuannStrauss, That's understating it. And when you finally see the errors, it says T_PAAMAYIM_NEKUDOTAYIM. Or maybe "must be an instance of integer, integer given". –Pacerier Apr 3 '15 at 20:02 Tutorial on this: code2real.blogspot.com/2015/06/… –Pupil Sep 9 '15 at 7:21 add a comment| 27 Answers 27 active oldest votes up vote 347 down vote accepted For syntax errors, you need to enable error display in the php.ini. By default these are turned off because you don't want a "customer" seeing the error messages. Check this page in the PHP documentation for information on the 2 directives: error_reporting and display_errors. display_errors is probably the one you want to change. If you can't modify the php.ini, you can also add the following lines to an .htaccess file: php_flag display_errors on php_value error_reporting 2039 You may want to consider using the value of E_ALL (as mentioned by Gumbo) for your version of PHP for error_reporting to get all of the errors. more info
Support Search GitHub This repository Watch 109 Star 1,377 Fork 171 JosephLenton/PHP-Error Code Issues 25 Pull requests 18 Projects 0 Wiki Pulse Graphs Better error reporting for PHP, and prettier too! http://phperror.net/ 171 commits 1 branch php error log 0 releases 5 contributors PHP 100.0% PHP Clone or download Clone with HTTPS Use Git php error reporting not working or checkout with SVN using the web URL. Open in Desktop Download ZIP Find file Branch: master Switch branches/tags Branches Tags master php ini error reporting Nothing to show Nothing to show New pull request Latest commit 9918dd5 Aug 5, 2013 3 Joseph Lenton fixed issue with slashes not being escaped, when replacement code is … … …uploaded Permalink Failed to load http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php latest commit information. example changed name on 'thrown exception' test Oct 10, 2012 src fixed issue with slashes not being escaped, when replacement code is … Aug 5, 2013 .gitattributes first chekin Jun 10, 2012 .gitignore first chekin Jun 10, 2012 Readme.md made the warning in the Readme.md file more prominent Mar 24, 2013 composer.json Update composer.json Nov 6, 2012 Readme.md PHP Error | Improve Error Reporting for PHP PHP errors are not good https://github.com/JosephLenton/PHP-Error enough for development, it's as simple as that. This aims to solve this. When an error strikes, the page is replaced with a full stack trace, syntax highlighting, and all displayed to be readable. Works with Ajax too! If the server errors during an ajax request, then the request is paused, and the error is displayed in the browser. You can then click to automatically retry the last request. This requires no changes to your JavaScript, and works with existing JS libraries such as jQuery. Check out the project homepage for a live demo. Do not use on a live site! To help make development easier, this deliberately makes your code unsafe. External requests are allowed to change your code, it shows more about your site, gives you more info, and makes trivial errors fatal. All of that is awesome if you want to fix bugs in less time, but in production, it is totally unsafe. seriously, only use this for development! In case you forget, you can disable this in production using the 'php_error.force_disabled' php.ini option (see below). Features trivial to use, it's just one file errors displayed in the browser for normal and ajaxy requests ajax requests are paused, allowing you to automatically re-run them makes errors as strict as possible (encourages code quality, and tends to improve performan
and Objects Namespaces Errors Exceptions Generators References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Context http://php.net/manual/en/ref.errorfunc.php options and parameters Supported Protocols and Wrappers Security Introduction General http://www.w3schools.com/php/php_error.asp considerations Installed as CGI binary Installed as an Apache module Session Security Filesystem Security Database Security Error Reporting Using Register Globals User Submitted Data Magic Quotes Hiding PHP Keeping Current Features HTTP authentication with PHP Cookies Sessions php error Dealing with XForms Handling file uploads Using remote files Connection handling Persistent Database Connections Safe Mode Command line usage Garbage Collection DTrace Dynamic Tracing Function Reference Affecting PHP's Behaviour Audio Formats Manipulation Authentication Services Command Line Specific Extensions Compression and Archive Extensions Credit Card Processing Cryptography php error messages Extensions Database Extensions Date and Time Related Extensions File System Related Extensions Human Language and Character Encoding Support Image Processing and Generation Mail Related Extensions Mathematical Extensions Non-Text MIME Output Process Control Extensions Other Basic Extensions Other Services Search Engine Extensions Server Specific Extensions Session Extensions Text Processing Variable and Type Related Extensions Web Services Windows Only Extensions XML Manipulation Keyboard Shortcuts? This help j Next menu item k Previous menu item g p Previous man page g n Next man page G Scroll to bottom g g Scroll to top g h Goto homepage g s Goto search(current page) / Focus search box debug_backtrace » « Examples PHP Manual Function Reference Affecting PHP's Behaviour Error Handling Change language: English Brazilian Portuguese Chinese (Simplified) French German Japanese Korean Romanian Russian Spanish Turkish Other Edit Report a Bug Err
Learn Bootstrap Learn Graphics Learn Icons Learn How To JavaScript Learn JavaScript Learn jQuery Learn jQueryMobile Learn AppML Learn AngularJS Learn JSON Learn AJAX Server Side Learn SQL Learn PHP Learn ASP Web Building Web Templates Web Statistics Web Certificates XML Learn XML Learn XSLT Learn XPath Learn XQuery × HTML HTML Tag Reference HTML Event Reference HTML Color Reference HTML Attribute Reference HTML 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 XSLT Reference XML Schema Reference Charsets HTML Character Sets HTML ASCII HTML ANSI HTML Windows-1252 HTML ISO-8859-1 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 XSL 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 Crea