Netbeans, PHP and Ubuntu

Netbeans was recommended as a good IDE for PHP in a sitepoint blog item recently. So I thought I’d check it out. The version in the Intrepid repository was a bit old (6.1) so I grabbed the version which included PHP support from the Sun website. The result was a file called “netbeans-6.5-ml-php-linux.sh” which I ran by the command:
bash netbeans-6.5-ml-php-linux.sh

Strangely, the Project properties had an extraneous ~username/ in the source path (under project properties > source). This was easily removed.

The other thing I needed to add was xdebug support (I had already set up Apache, PHP, and MySQL previously). This was surprisingly easy. There were some excellent instructions here, here, and here.

sudo apt-get install php5-xdebug
Open file /etc/php5/conf.d/xdebug.ini e.g.
sudo gedit /etc/php5/conf.d/xdebug.ini
and add line:
xdebug.remote_enable=on
Then restart apache:
sudo /etc/init.d/apache2 restart

The debugging worked well and I found everything intuitive. I think I have my new PHP IDE for Ubuntu 🙂

And the development is ongoing. Check out the blog at http://blogs.sun.com/netbeansphp/ for a sense of where things are going.

The sitepoint blog item also included some excellent tips on how to use the functionality to make life easier. Worth bookmarking.

UPDATE – even better I managed to get client-side debugging to work as well so I can click on buttons in my web databases and follow the steps through checking variable values as I go. The key is to install the netbeans firefox extension. This was done automatically when I selected “Server side PHP with client side Javascript etc …” as the debug option and Firefox. I was given the option of installing the browser addon. Fantastic ever since. Just turn debug listening on at the Netbeans end and you are away. Apparently it will be possible to activate this listening from the browser end in a newer version of Netbeans (http://forums.netbeans.org/post-9585.html).