Saturday 23 July 2011

PHP Development with NetBeans 7.0

In this post, I'm going to be going through creating a simple PHP project using the NetBeans 7.0 IDE and deploying it to a development Apache HTTP server, running on the same machine. All of the instructions below were tested on Ubuntu 10.04 and assume that you have a LAMP stack (although we don't need the MySQL component for now) and NetBeans installed (I've used the All bundle, which comes with PHP) and have the userdir module for Apache turned on (see my previous post).

In terms of usability, I find NetBeans to be one of the best open source PHP IDE's available, with excellent support for things like autocomplete and debugging, which make development a whole lot easier.

To start off with, open up NetBeans and create a new PHP Project:

I've set the project name to "PHPHelloWorld" and I found that NetBeans detected my ~/public_html folder automatically:

NetBeans also detected my local web server and URL settings:

For our simple HelloWorld application, we don't require any PHP frameworks:

After clicking 'Finish', we end up with the default PHP template:

Now I added some code, including a function to the index.php file. I've included a function in the code so that when you type it out you can see some of the NetBeans autocomplete features:

Finally, click on the 'Run Project' button (or hit F6) and watch as your program deploys:

No comments: