Zend 2 + Netbeans + Xampp

written by


June 17, 2016


Web Development

27 steps is simple right? (sarcasm)

I love using the Netbeans IDE. It offers everything I need in an IDE including CSS pre-processing in LESS and SASS, php code assistance, and GIT. Most recently I’ve been diving into the Zend Framework – the framework built by creators of php. I’ve recently learned that Netbeans has the ability to create a Zend Framework application right out of the box. However, your computer must have some dependent libraries installed.

I will walk you through the steps to install a Zend Framework Skeleton application using Netbeans IDE within a Windows PC environment using XAMPP to develop locally. This tutorial is meant to note my own personal installation but I’m betting that a few other people out there would find this useful as well.


  • You have installed the latest Netbeans IDE (currently v. 8.1)
  • You have already installed XAMPP
  • You are running a Windows machine (process may be similar for Linux and Mac)
  • You are developing locally

Install and Configure Netbeans to use Composer

  1. Download Composer at https://getcomposer.org/download/
  2. Install composer using the Composer-Setup.exe file
  3. Test to see if Composer installed correctly by typing “composer” into the command prompt. You should get something like this:
  4. Open the command prompt and run the code below to update to the latest version:
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php -r "if (hash_file('SHA384', 'composer-setup.php') === '070854512ef404f16bac87071a6db9fd9721da1684cd4589b1196c3faf71b9a2682e2311b36a5079825e155ac7ce150d') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    php composer-setup.php
    php -r "unlink('composer-setup.php');"
  5. Locate the composer.phar file and copy the file path. The file path for my installation is located here: C:\ProgramData\ComposerSetup\bin\composer.phar. Your system my not show the ProgramData directory with your file explore (most likely). If you don’t see it, try typing in the my file path directly into your file explorer window.
  6. In Netbeans, go to Tools->Options and select PHP, then select the Frameworks and Tools tab.
  7. Select Composer in the list. Paste in the composer.phar file path into the field provided and apply the settings.
    Netbeans Composer

Configure Neabeans to use the PHP 5 Interpreter

This step is required before we can create a Zend Framework application. If you skip this step you will get an error when building your application.

  1. In Netbeans, navigate to Tools->Options and select PHP, then select the General tab.
  2. Locate your php.exe path and paste it into the PHP 5 Interpreter field. My path is show as C:\xampp\php\php.exe
    Netbeans PHP 5 Interpreter
  3. Apply the settings.

Install the Zend Framework Skeleton and Configure Netbeans

  1. Download the Zend Framework Skeleton from Github (.zip file)
  2. Do not unzip the .zip file. Upload it somewhere on your drive. I chose C:\zend\ZendSkeletonApplication-master.zip
  3. In Netbeans, navigate to Tools->Options and select PHP, then select the Frameworks and Tools tab.
  4. Select Zend 2 in the list and enter the path for the ZendSkeletonApplication-master.zip file
  5. Apply the settings.

Create a Zend Framework Skeleton Application

  1. In Netbeans, select the New Project button
  2. Select PHP Application and hit Next
  3. Enter the name and location of your application and hit Next
  4. On the Run Configuration screen, leave the it to run as Local Web Site and use the default Project URL. Hit Next.
  5. On the next screen, select the Zend 2 PHP Web Framework and hit Next.
  6. On the Composer screen, leave all the fields empty and hit Finish. The project will now build. Cross your fingers!

At this point, if we visit http://localhost/zendtest we should get a Zend Framework 2 Skeleton page. Be sure you have the XAMPP Apache service started. Did you get it? High fives!

Configuring the Localhost Domain

In this step we will set up a domain for our project on our localhost within our XAMPP Apache server.

  1. Open up the XAMPP Control Panel. Click the Config button for the Apache service.
  2. Select the httpd.conf file
  3. At the very end of the file, add the following:
    <VirtualHost *:80>
         ServerName zendtest.com
         DocumentRoot C:\xampp\htdocs\zendtest\public
         SetEnv APPLICATION_ENV "development"
         <Directory C:\xampp\htdocs\zendtest\public>
             DirectoryIndex index.php
             AllowOverride All
             Require all granted
  4. Save and close the file (this step is important)
  5. Restart Apache
  6. Now open your hosts file and point the domain to your localhost:       zendtest.com

And there we have it! zendtest.com should now show our new application.

Zend Framework 2 Programmer’s Reference Guide