Setting up a LAMP on a Virtual Box
An almost step-by-step tutorial

Developer IDEs

Tough guys with big 'cojones' use vi (it's a hardcore "pain in the ass" command line text editor). But the smart and efficient guys use one of the great IDEs.

There are many development tools in the market to use. Some of them are free, some of them not. Some of them are good for everything and some of them are good for nothing. Depending on what kind of developer you are, you may choose your favorite tool. Or you can use a free-but-good one.

Netbeans PHP

I think the best choice is the Netbeans IDE (sorry PDT Eclipse fans). I use it for years now and I found it better, faster and more stable than the Eclipse or any other tool on the freeware section. To download and install type the following in the Terminal:

$> cd ~/Downloads/ $> wget $> mv ./5tyaesf $> chmod +x ./ $> sudo ./

An installer will start soon.

The Netbeans installer

Follow the instructions. When it's done, you will find the launcher in the Applications > Programming menu.

Showing the Netbeans' features is not part of this tutorial. Simply use it and learn it. The only thing I have to show in general is the SVN usage.

Run Netbeans and on the Projects sidebar (or from the File menu) choose the New Project... and select the “PHP Application with Existing Sources” option. For sources folder give the /var/www/ and for Project URL give the address. Then click Finish.

The project now is imported. On the Source Files choose the Subversion context menu to access the SVN functions. With the Show Changes you will get a list of new files and folders generated by the Netbeans.

Take the following checklist to make Netbeans a useful and comfortable PHP developer tool:

  • Global Include Path

    choose Tool > Options > PHP tab > General tab > Browse and navigate to /var/wwwlib/library.

  • PHP Smarty Framework

    choose Tool > Plugins > Available Plugins tab check the PHP Smarty Framework and press Install button.

  • Speed up Netbeans with disabling unneeded plugins

    choose Tool > Plugins > Installed tab and check plugins you don't need like: Mercurial, Hudson, and CVS, then press the Disable button.

  • Use macros

    record your favorite macros to speed up development.

  • Use hotkeys

    set hotkeys for your favorite functions or built-in macros like: delete line, duplicate line, move line etc.

Netbeans and xdebug

We have xdebug, and now we have an IDE too. Let’s make them work together.

If you have chosen to go after your own head and you installed some extensions more, it is good to know that Xdebug is incompatible with the Zend Optimizer and Zend Studio Debugger extensions. These extensions (if installed) should be commented out in the ini file that is used by the PHP (php.ini, modules.ini etc).

To make these tools cooperate together we need a browser extension and some configuration.

  1. First we have to enable the xdebug for a project. To do this create/edit the .htaccess file in its document root and insert:

    php_value xdebug.remote_enable 1 php_value xdebug.remote_host php_value xdebug.auto_profile 1 php_value xdebug.profiler_enable 1 php_value xdebug.auto_trace 1

    If we work on two or more projects on parallel, then we might override some other options more like profiler and trace file name.

  2. The second step is to help the browsers to support the communication between the server and Netbeans:

    1. for Firefox search and install the easy Xdebug extension
    2. for Google Chrome search and install the Xdebug helper extension
  3. Open Netbeans, and select the Tools > Options menu > PHP tab and ensure you have set the same values as in the xdebug.ini file.

    Setting the debugger
  4. On the Netbeans’ toolbar open the dropdown menu and choose Customize...

    Costumizing debugger

    Create a new Configuration and name it anyhow you like. I prefer ‘Xdebug’. Make it Run As a ‘Local Web Site’ and set the Project URL to ‘’. The Index File is simply ‘index.php’.

    Xdebug configuration

    On the ‘Sources’ tab make sure you have the correct options set for the project:

    Check settings
  5. Press Ctrl+F5 to run the debugger. New tabs will be opened in the browser but we are interested in the debugger in Netbeans. You have to see something like this (depending on what the index.php contains of course):

    Run the debugger

    And remember. If you don’t know how to use the debugger maybe you don’t even need it.


We made the xdebug to create profiles upon debugging. To visualize the results we have to install the KCacheGrind tool which is unfortunately requires KDE (in comparison the Ubuntu uses Gnome).

Of course we can install it, but it will use tons of KDE resources which will use a huge disk space. Never mind, go on. In the Terminal type:

$> sudo apt-get install kcachegrind

Run the KCacheGrind tool located in the Applications > Programming menu and browse the profiler file we set in the xdebug.ini file or in the .htaccess:

The KCacheGrind tool

Of course a real project generates a really useable and informative profiler report.

MySQL Workbench

To manage and query MySQL databases the MySQL Workbench is the best freeware tool to choose. C'mon, phpMyAdmin is pretty good tool but it's more like in the XAMPP’s group than in the professional league.

Way one

Go to and choose the Ubuntu from the dropdown list. Download the ".deb" file.

Unfortunately the Ubuntu Software Center won't be able to handle it (did not for me), and won't install the package, so we have to do a little trick, and install it in another way.

In the Terminal type the following:

$> sudo apt-get install gdebi $> cd ~/Downloads/ $> chmod +x ./mysql-workbench-gpl-5.2.33b-1ubu1010-i386.deb $> sudo gdebi ./mysql-workbench-gpl-5.2.33b-1ubu1010-i386.deb

Way two

Or you can simply use the good old way:

$> sudo apt-get install mysql-workbench-gpl


The first taste is a bit weird but then easy to get used to it. The workbench separates general and administrative usage. You can found the workbench tool in the Applications > Programming menu.

In the beginning we don’t have project databases to connect to so we have to connect to the MySQL’s own database. To do this, select the ‘New Server Instance’ on the lower right side.

Add new connection

Give the MySQL’s root password when asked (if you remember, I gave ‘x’ as root password). Then it checks whether it can connect to the database with the given credentials. There should be no problem.

In the ‘Management and OS’ section set Linux as operating system and Ubuntu Linux (MySQL Package) as MySQL installation type.

Then it will run through the rest processes and you can finish setting up the Server Instance.

Now you have a connection for query and one for administration.

Workbench Workspace

In the Server Administration you can manage users, schemas, privileges etc. And this is where you can import/export (dump) databases, tables form/to file.

It’s an easy to use tool so I won’t grab your hand to give you a guided tour. This is why it’s just an almost step-by-step tutorial.