This “howto” is based on the following model: -Ubuntu v 10.04 -Eclipse v 3.5.2 -Local LAMP server
Requirements: -LAMP already installed -Eclipse already installed
Server configuration: -Open a terminal -run: sudo apt-get install php5-xdebug -run: sudo nano /etc/php5/conf.d/xdebug.ini -Don’t delete the content of this file, just go to the end of the file add 2 blank lines and paste the next configuration:
xdebug.remote_enable=On xdebug.remote_host=”localhost” xdebug.remote_port=9000 xdebug.remote_handler=”dbgp”
-save changes -run: sudo service apache2 restart
Eclipse configuration: -Open eclipse -On the eclipse main menu go to: Help–> Install New Software… -open the dropDownList “work with” -select “–All Available Sites–” -On the filter text field put: php -Check out: “Programming Languages” -Check out: “Web, XML, and Java EE Development” -Follow the wizard instruction until finish -On the eclipse main menu go to: Window–> Preferences -Navigate on the tree menu to: PHP–> Debug -open the dropDownList “work with” -On “PHP Debugger” select “XDebug” -Leave alone “Server” and “PHP Executables” -Save changes and close the window -On the eclipse main menu go to: Run–> Debug configurations… -Do a double click over “PHP Web Page” just to add a new setting -On the DropDowList “Server Debugger” select “XDebug” -On the file section browse and select the “index.php” of your project or whatever file you need to start your application -Uncheck “Break at Fist Line” -Apply changes and close the window -On the eclipse main menu go to: Window–> Web Browser–> Default System Web Browser
Testing xdebug -Open a project with source code that already is hosted in your LAMP server -Place a “break point” at some point of you script -Press “F11” to start the debugger -Your code should stop at the break point -Now move the mouse over variables so watch its values
That is all i hope you enjoy this HowTo