- PHP - Coding Standard
- PHP - File Uploading
- PHP - Sending Emails
- PHP - Sessions
- PHP - Cookies
- PHP - Functions
- PHP - Files & I/O
- PHP - File Inclusion
- PHP - GET & POST
- PHP - Web Concepts
- PHP - Strings
- PHP - Arrays
- PHP - Loop Types
- PHP - Decision Making
- PHP - Operator Types
- PHP - Constants
- PHP - Variable Types
- PHP - Syntax Overview
- PHP - Environment Setup
- PHP - Introduction
- PHP - Home
Advanced PHP
- PHP - For PERL Developers
- PHP - For C Developers
- PHP - Object Oriented
- PHP & XML
- PHP & AJAX
- PHP & MySQL
- PHP - Date & Time
- PHP - Bugs Debugging
- PHP - Error Handling
- PHP - Regular Expression
- PHP - Predefined Variables
PHP Form Examples
PHP login Examples
PHP AJAX Examples
PHP XML Example
- PHP - DOM Parser Example
- PHP - SAX Parser Example
- PHP - Simple XML GET
- PHP - Simple XML
- PHP - XML Introduction
PHP Frame Works
PHP Design Patterns
PHP Function Reference
PHP Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
PHP - Bugs Debugging
Programs rarely work correctly the first time. Many things can go wrong in your program that cause the PHP interpreter to generate an error message. You have a choice about where those error messages go. The messages can be sent along with other program output to the web browser. They can also be included in the web server error log.
To make error messages display in the browser, set the display_errors configuration directive to On. To send errors to the web server error log, set log_errors to On. You can set them both to On if you want error messages in both places.
PHP defines some constants you can use to set the value of error_reporting such that only errors of certain types get reported: E_ALL (for all errors except strict notices), E_PARSE (parse errors), E_ERROR (fatal errors), E_WARNING (warnings), E_NOTICE (notices), and E_STRICT (strict notices).
While writing your PHP program, it is a good idea to use PHP-aware editors pke BBEdit or Emacs. One of the special special features of these editors is syntax highpghting. It changes the color of different parts of your program based on what those parts are. For example, strings are pink, keywords such as if and while are blue, comments are grey, and variables are black.
Another feature is quote and bracket matching, which helps to make sure that your quotes and brackets are balanced. When you type a closing depmiter such as }, the editor highpghts the opening { that it matches.
There are following points which need to be verified while debugging your program.
Missing Semicolons − Every PHP statement ends with a semicolon (;). PHP doesn t stop reading a statement until it reaches a semicolon. If you leave out the semicolon at the end of a pne, PHP continues reading the statement on the following pne.
Not Enough Equal Signs − When you ask whether two values are equal in a comparison statement, you need two equal signs (==). Using one equal sign is a common mistake.
Misspelled Variable Names − If you misspelled a variable then PHP understands it as a new variable. Remember: To PHP, $test is not the same variable as $Test.
Missing Dollar Signs − A missing dollar sign in a variable name is really hard to see, but at least it usually results in an error message so that you know where to look for the problem.
Troubpng Quotes − You can have too many, too few, or the wrong kind of quotes. So check for a balanced number of quotes.
Missing Parentheses and curly brackets − They should always be in pairs.
Array Index − All the arrays should start from zero instead of 1.
Moreover, handle all the errors properly and direct all trace messages into system log file so that if any problem happens then it will be logged into system log file and you will be able to debug that problem.
Advertisements