Configure xdebug with Eclipse and PDT in CentOS

Posted: July 15, 2012 in Linux, PHP
Tags: , , , ,

You can install xdebug with the below command line if pecl is installed

pecl install xdebug

Or follow the similar way in Installing mcrypt to install it yourself. Make sure you change the last step to the below in php.ini

zend_extension=”/the/path/to/xdebug.so”

otherwise you may receive this error: Xdebug MUST be loaded as a Zend extension.

To keep php.ini clean, in my installation, I create a new xdebug.ini in /etc/php.d/, the content is as below.

zend_extension=”/usr/lib64/php/modules/xdebug.so”

[xdebug]
xdebug.remote_enable=On
xdebug.remote_host=”localhost”
xdebug.remote_port=9000
xdebug.remote_handler=”dbgp”

Next configure Eclipse to use xdebug as debugger.

Open Eclipse, go to Window->Preferences, expand PHP->Debug, select XDebug as PHP Debugger.

 

Under General->Web Browser, you can also choose use external web browser.

Save your changes and close Preferences.

Next go to Run->Debug Configurations. Under PHP Web Application, create a new configuration there. Below are my settings.

You need also configure the default PHP Server to point to your server here.

Now you start to debug your php project with xdebug.

Advertisements
By Image Karthik Posted in Others

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s