XAMPP with NetBeans
By jonasdias on Mar 13, 2008
I'm programming a little registration web system for NACAD (the lab I do work in at UFRJ) using PHP. I was already using xampp platform to have Apache, MySql and PHP working together easily for development. Then I noticed a cool PHP plugin for NetBeans 6.0 and then, decided to use, since there is no real good IDE for php development.
Let's start from the beginning. ;D
You can download XAMPP for Solaris, Linux, Windows and Mac at http://www.apachefriends.org/en/xampp.html . It's installation is really easy, you can find any necessary information on xampp's site above. After installation, you may start your services using:
$sudo /opt/lampp/lampp start
Notice that /opt/\*ampp is the directory you (yourself) chose to install xampp. We usually istall on /opt but you may put it anywhere you like.
Your projects folder must be inside the htdocs folder on xampp installation directory to be accessed trough http://localhost/myProject/index.php, for example, like:
Since myProject folder keeps all your PHP scripts, HTML, images, etc...
Now you may open your NetBeans. You don't have it yet ?!?! Come on! Download it at www.netbeans.org.
Open NetBeans! If your NetBeans do not support PHP (yet), go to Tools > Plugins on the Menu Bar. You may find PHP plugin on the “Available Plugins” Tab. Mark the check box and press Install button to take it!
Press Next button and accept the terms of the contract, then go on through the installation! After finished, you may restart your fantastic IDE.
After that, let's create our new Project. Go to File>New Project menu option. Choose PHP on the left box and on the right one choose PHP project with existing sources (or just PHP project if you are about to start a project from the zero).
Choose your project name, it's location and folder. Notice it's not the folder where your existing sources are in, it's just where NetBeans will keep your project settings and other stuffs.
Now you may give the folder where your existing sources are. On my example, it would be at /opt/lampp/htdocs/myProject.
This step is to set your web server. Using xampp, you would be running apache, so you should inform NetBeans about it to let him test your application directly using the existing server. Don't worry, it will be really easy.
On the Configured Web Servers drop down menu, you may just see No Servers.
Press Manage Button.
On the new screen, chose a connection name (xampp for example). On Server type, chose Local Web Server with File Access.
On next screen you have to point the server configuration file, i.e., show the httpd.conf apache configuration file path to NetBeans.
httpd.conf can be found at xampp_instal_directory/etc (for example: /opt/lampp/etc/httpd.conf on Windows it'll be at /xampp/apache/httpd.conf), as you can see:
On Choose host N... menu, choose localhost, and press Next.
Write localhost on server name and leave port 80 for default http configuration.
You can leave Base Directory field empty. Press Next.
On the file access configuration, write the path to your project. DON'T leave /opt/lampp/htdocs directory path only, you may don't have write access to this directory, put /opt/lampp/htdocs/myProject and be sure you have read and write permissions at myProject folder.
Now you can finalize the server configuration and choose it as your Configured Web Server on your Project Creation Window.
Now you may finalize your project creation and start working!