Thus, I always create a file/program (which I usually call "genwrap.php") which has essentially the same code as the popular solution here (ie. This is contrary to the note above which says that the two instructions are equivalent. up down 1 Chris ¶10 years ago I found some simple mistakes in the share|improve this answer answered Feb 2 '14 at 20:47 Madara Uchiha♦ 86.4k32147211 add a comment| up vote 24 down vote There is a really useful extension called "xdebug" that will make 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 navigate to this website
With syntax errors, the script doesn't even get to runtime. By default these are turned off because you don't want a "customer" seeing the error messages. Don't forget to stop Apache server before doing modifications and start it again after saving these modifications. error_reporting = E_ALL & ~E_NOTICE Above it instructs to discard errors fall into notices category. http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php
In this case the values must be set in the ini directly -- for a pure development environment this may be preferable anyway. –Tomalak May 10 '09 at 10:00 add a But in development, you would rather like to see errors on the web browser and would set the settings other way around. There is a error file error.log for apache2 which logs all the errors. For PHP 4, this will be all constants. ]
There is also an E_ALL which is the first 4 E_xxx added up for you... up down -4 roberto
If you need to debug a production website in its production environment and only want you to be able to view the errors, use $_SERVER['REMOTE_HOST'] to check whether the client is, This should be turned off in production servers, but not when you're developing. Best ways to write following two lines on the top of script to get all errors messages: error_reporting(E_ALL); ini_set("display_errors", 1); Another way to use debugger tools like xdebug in your IDE. share your code here...
As a useful tip - when you're setting up your site it's handy to do a switch for your different environments so that these errors are ON by default in your Php Display Errors Off Meaning, it'll run when the script runs! In shared hosting, it may be in a dedicated folder or on the same folder as the offending script. The best way to debug php code is to use the console; run the following: php -l phpfilename.php share|improve this answer edited May 4 at 20:22 JonasCz 6,02151745 answered May 4
share|improve this answer answered May 10 '09 at 9:59 gnarf 73.5k1497149 2 Indeed, this is a very useful debugging tool—makes error messages much more verbose, with full stack traces and navigate here share|improve this answer answered May 10 '09 at 9:54 Tomalak 208k41346464 1 This doesn't work for syntax errors as Candidasa mentioned. –Darryl Hein May 10 '09 at 9:56 2 Error Reporting Php Ini Check! Php Error Reporting Not Working How to enable error reporting in a PHP script? There are two ways to enable error reporting in your PHP scripts. 1.
This prevents users seeing any sensitive information that can go with error reports and let you still see them via web server's error log. useful reference more info 3 other items: (1) You can check the error log file as it will have all of the errors (unless logging has been disabled). (2) Adding the following 2 You can add the following line: php_value display_errors 1 I had the same issue as yours and this solution fixed it. see more linked questions… Related 2787How can I prevent SQL injection in PHP?679How do I get PHP Errors to display?40How can I get PHP to produce a backtrace upon errors?2PHP escaping Php Error Types
Learn More See Our Values Get to know our guiding principles! But fear not! up vote 369 down vote favorite 168 I find programming in PHP quite frustrating. my review here Did you mean ?
See Also The display_errors directive The html_errors directive The xmlrpc_errors directive ini_set() - Sets the value of a configuration option add a note User Contributed Notes 29 notes up down 220 Php Error Message Here is how to turn on PHP errors:To display error messages caused by your PHP script you can include these lines of code:ini_set('display_errors',1); error_reporting(E_ALL);Another way to do it is to edit more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed
also something equivalent here too w3schools.com/php/func_error_reporting.asp –MarcoZen Oct 30 '13 at 4:53 add a comment| up vote 5 down vote error_reporting(E_ALL | E_STRICT); And turn on display errors in php.ini share|improve It's a very good visual reference and helped me understand the complex error reporting mechanism. The available error level constants and the actual meanings of these error levels are described in the predefined constants. get redirected here Browse other questions tagged php debugging error-handling or ask your own question.
How to enable displaying php errors on site How to enable displaying php errors on site Category: Joomla!