Friday, February 18, 2011

part 9 / 13 : Set a debug configuration for PHP debug

First of all, we'll modified the index.php:
Open index.php file. And modify it as shown here:

and save it: Ctrl+S
Then add a breakpoint in front of the line: echo $my_first_variable;
To do it, do a double click on the left of the text, a blue point will appear as shown on the last picture.

Start xampp:
on your desktop click on:






Then press Start to run apache, you'll get:


Come back to eclipse.


Run->Debug Configuration...
select: PHP Web Page
Press the 'New' button:
                                    
And complete the parameters as shown:

Press "Debug" to launch the debug session.

Eclipse ask you to confirm to switch Perspective:

select: Remember my decision
and click Yes.

If eclipse did not asked you to open the PHP Debug perspective, you'll found it like this:
Window->open perspective->Other...
PHP Debug
OK

A firefox window opens.

In eclipse, if you left the "break at first line" in the parameters we set above, you should see that:

The session is break on the first line of the php script.
Press  and the execution will go to the next breakpoint.
Press  again, the execution will end.

In the firefox window, you'll see the result of the execution.

you can see "XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=12981329118077" after the link to your web page. For each debug session xdebug set a key number.

You don't need to restart the debug from eclipse. You can make change in eclipse editor and reload the page from firefox, try it.
To close the debug session press '"ctrl + F2" and then :near the 

Done.

Next post: installation of aptana plugin.

No comments:

Post a Comment