Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Php code?

Tags:

php

I am newbie on PHP. Here is my situation. I write my code in vim and put it under /var/www/ then I can use

localhost/*.php

to run my code on browser.

When my code has bug. It just come out nothing.

How can I debug mu code like c++ or java?

Thanks.

Edited:

The link some friends provide is not helpful for me. I am under Linux. That's for Win.

like image 596
Don Lun Avatar asked Apr 19 '11 01:04

Don Lun


People also ask

How do I debug PHP in Chrome?

Q: How to debug PHP in Chrome? A: You can easily debug PHP in Chrome using a simple extension called PHP Console. Just install this PHP debugging tool from the Chrome web store and start logging errors, warnings, exceptions, and vars dump on your Chrome browser.

What is debugging process in PHP?

Xdebug is a PHP extension which provides debugging capabilities. It uses the DBGp debugging protocol. Xdebug is a PHP extension which provides debugging and profiling capabilities. It uses the DBGp debugging protocol. At this end this tool is responsible to enable the debugging on PHP, and Xcode takes advantage of it.


1 Answers

include this both line in code to see what kind of error is.

<?php 
       ini_set("display_errors",1);
       error_reporting(E_ALL);
        //code goes here
?>
like image 180
ThisisFish Avatar answered Nov 09 '22 21:11

ThisisFish