I use Eclipse as PHP IDE with several plugins.

I use Eclipse as PHP IDE with several plugins.

I’d share on this blog my experience with Eclipse to write my PHP code.
Before I always used vi to write my code but I was looking for another solution to be able to make easy debug.
I tested several IDE : Zend Studio, Anjuta, Bluefish, etc… I was happy with some of them but never very happy, not free, debug not available, debug but not with extra modules not available in the interpretor delivered with the IDE, etc..
So I decided finaly to try Eclipse… and the result is : I’m very very happy with it. Of course I configured it with some extra modules :

  • phpeclipse : Integration of PHP environment and debug
  • subeclipse : Integration of Subversion
  • viPlugin : finally and IDE with vi commands… a dream came true 😉

Note: viPlugin is not gratis anymore, but an old version is always available on sourceforge.

As I like to test new distribution, I switched my gentoo for the new Fedora Core 6, and I’m happy with it for the moment !

In the following section I describe how to configure your system to enable the debugger:

I created a rpm for the DBG, available here.

Then I modified the new file added, /etc/php.d/dbg.ini, with that rpm as follows :

; Enable dbg extension module
; added by

debugger.enabled = true
debugger.profiler_enabled = true

In Eclipse, select in the toolbar Run, Debug and in a new debug environment, enable Remote Debug :

Enter the PHP interpreter :

Run the debugger.

In your code add a breakpoint (double click in the margin) :

Then open firefox (or any opensource browser) and add the following line, ?DBGSESSID=1@localhost:10001 to the url of your program :

And as you can see, the program will stop and in Eclipse you can go step by step in your PHP code and see the content of the variables :

You can use F5 to run the program step by step.

I hope this entry will help you and will give you the desire to test Eclipse to code PHP.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

As MySQL Community Manager, I am an employee of Oracle and the views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

You can find articles I wrote on Oracle’s blog.