PHP Debugger

How to debug your PHP project

It is assumed that the server is installed locally to work (php apache mysql etc ...).

Get Eclipse from here

On Eclipse go to Run -> Debug Configurations
Click new configuration

new configurations image new configurations image

Folder: Server
*Name: php-debugger (can chose another name, of course! :) )
*PHP server - default PHP Web Server
*File: /newProject/index.php
Open configure...
*Debugger: xdebug
*base url: http://localhost
*local web root: /var/www/html/newProject
*OK
*new configurations image

Folder: Debugger
*Server Debuger --> XDebug
APPLY
CLOSE

go to /var/www/html and create a new folder "newProject"

Create a PHP Project in eclipse (using, of course, the folder you created)

Create new file index.php with some code to text and set a breakpoint with double click on the left side of the code

Open php.ini
sudo gedit /etc/php5/apache2/php.ini
past the code

code:
xdebug.remote_enable = On
new configurations image
save the file and exit
restart apache: sudo /etc/init.d/apache2 restart

new configurations image

Run, Debug as... , PHP web application

new configurations image

Will open a web browser inside eclipse

________
ZXCoders

Comments

Marco's picture

I recomend Eclipse Luna. Mars has to many bugs...

Luna