Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds

Develop PHP Web Applications with NetBeans, VirtualBox and Turnkey LAMP Appliance

Save for later
  • 240 min read
  • 2009-10-01 00:00:00

article-image

A couple of days ago, a client asked me for an easy way to develop PHP applications. Naturally, I told him the best way would be to pay me for doing it! Just kidding…

"Use the NetBeans IDE", I said to him, almost automatically. "But… isn’t NetBeans something related to Java?" he answered back, with a startled grin on his face.

"My dear friend, you can use NetBeans to develop software on Java, PHP, C++, and almost any other programming language I’ve heard of! You could even use it to work on a WordPress live Web site!" I said to him triumphantly. And that’s when a small light bulb lit up inside my mind... I introduced him to VirtualBox and the world of virtual machines, the Turnkey Linux LAMP appliance, and how to make all these software applications collaborate between each other. And that’s how this article was born.

So now, my dear readers, let’s get on with the action! Oh, and feel free to skip any section you don’t need, ok?

Download and Install VirtualBox

Go to the VirtualBox Web site and download the most recent version: http://download.virtualbox.org/virtualbox/3.0.4/VirtualBox-3.0.4-50677-Win.exe

After downloading VirtualBox, install it with all the default options (remember to register with Sun!).

Download the Turnkey LAMP appliance

Go to the Turnkey Linux Web site and download the LAMP appliance: http://www.turnkeylinux.org/download?file=turnkey-lamp-2009.02-hardy-x86.iso .

Download the NetBeans PHP IDE

Go to the Sun Web site and download the NetBeans PHP IDE here. After downloading NetBeans, install it with the default options.

Create a virtual machine

Open VirtualBox and click on the New button to create a virtual machine (VM). In the following screenshot I used the VirtualPHPDev name for my VM, but you can use whatever you want; just don’t use strange characters or signs:

develop-php-web-applications-netbeans-virtualbox-and-turnkey-lamp-appliance-img-0

Choose Linux and Ubuntu as the Operating System and Version, respectively. Click on Next to continue. Leave the default values for RAM and hard disk. When finished, click on the VirtualBox Settings button to open your virtual machine’s settings dialog, select the CD/DVD-ROM category, enable the Mount CD/DVD drive option, select the ISO Image File button and then click on the Invoke Virtual Media Manager button develop-php-web-applications-netbeans-virtualbox-and-turnkey-lamp-appliance-img-1.

develop-php-web-applications-netbeans-virtualbox-and-turnkey-lamp-appliance-img-2

Click on the Add button in the Virtual Media Manager to open up the Select a CD/DVD-ROM disk image file, go to the directory where you downloaded the Turnkey LAMP appliance and double-click on it to add it to the Virtual Media Manager:

develop-php-web-applications-netbeans-virtualbox-and-turnkey-lamp-appliance-img-3

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at €14.99/month. Cancel anytime

Click on Select to close the Virtual Media Manager, and then click on OK to exit the Settings dialog. Now you can click on the Start button to start your LAMP virtual machine:

develop-php-web-applications-netbeans-virtualbox-and-turnkey-lamp-appliance-img-4

Select the Install to hard disk option in the Turnkey Linux menu screen and press Enter to start installing the LAMP appliance on your virtual machine. Eventually the following screen will show up:

develop-php-web-applications-netbeans-virtualbox-and-turnkey-lamp-appliance-img-5

Select the Guided option and press Enter to continue. The installer will ask if you want to save changes to disk. Select Yes and press Enter. The installer will start the disk formatting process and then you’ll get to the root password screen. Type the password twice for the root user, and then do the same for the MySQL user. The installer will continue and, after a while, the following installation completion screen will show up:

develop-php-web-applications-netbeans-virtualbox-and-turnkey-lamp-appliance-img-6

Select No, press Enter and then close the virtual machine typing shutdown -r now at the system prompt. You’ll return to the VirtualBox main screen. With your LAMP virtual machine selected, click on the Settings button to open the settings dialog box. Select the CD/DVD-ROM category and disable the Mount CD/DVD drive option. Then select the Network category, change the Attached to: option to Bridged Adapter and click on OK to continue:

develop-php-web-applications-netbeans-virtualbox-and-turnkey-lamp-appliance-img-7

You can start your LAMP virtual machine now. When ready, the following screen will appear:

develop-php-web-applications-netbeans-virtualbox-and-turnkey-lamp-appliance-img-8

The Bridged Adapter mode lets your virtual machine act as if it were another PC on the LAN, and consequently, it will have a different IP address. Write down the IP address shown in the Turnkey Linux Configuration Console screen, because you’ll need it to configure the NetBeans IDE later. You can minimize the LAMP virtual machine window now.