group-icon
PHP Programming
Group for all things PHP, Coding Help, Problems and Solutions
101 Members
Join this group to post and comment.
DHIRAJ LOTLIKAR
DHIRAJ LOTLIKAR
Information Technology
28 Jan 2019

What are bugs debugging in php?

You will rarely see you program run at its first attempt that the program is running efficient will the required output. Many things will go wrong which will lead the php interpreter to generate an error message. You might don't know where the error message goes. The messages can be send with other program output on the web browser. They can also be located in the web server error log.

If you want to see the error messages on your web browser set the display_error configuration to ON. To send the error to the web server error log then set log_error to ON.

while writing your php code it is good to use PHP-aware editors like BBEdits or Emacs. One of the special feature of these editors are syntax highlighting. It changes the colour of different part of your program accordingly. 

Another feature is quote and bracket matching, which helps you to manage the balance of the number of brackets used in code. It matches the { and } braces with the same colour.

While debugging you should look for the following main statements in your code,

1)  missing Semicolon: Every PHP statement ends with a semicolon.

2) Comparison sign: Some of them gets confused in = and == operator. The = operator is for assigning a value while the == is for comparison.

3) Case sensitive variable name: The variable name is case sensitive. That means $Test is not equal to $test.

4) Missing dollar sign: In PHP the variable is denoted by a $ sign in beginning of the variable name. For example $variable_name.

5) Missing quotes and braces: The number of quotes and braces should be balanced.

I would suggest direct all error to the system log file so that if you are not getting any appropriate output then there is surely an error an you can check the error by Log file.