Skip to content

Zend 2 + Netbeans + Xampp

zend-xampp-netbeans

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.

Assumptions

  • 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:
    composer
  4. Open the command prompt and run the code below to update to the latest version:
  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
    zend-skeleton
  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
    new-zend-application
  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.
    zend-2-framework
  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.
    config-apache
  2. Select the httpd.conf file
  3. At the very end of the file, add the following:
  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:
    127.0.0.1       zendtest.com

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

Zend Framework 2 Programmer’s Reference Guide

Facebook Comments

About the Author