Zend Framework logo
Zend Framework logo

To install Zend Framework is not as straight forward like other PHP Frameworks. Also to install it with NetBeans it was not described very well on blogs.sun.com/netbeansphp site. Let’s start!

My assumption is that NetBeans is installed already on Ubuntu. I used NetBeans 6.9.1 and Ubuntu 10.10. In NetBeans are also the PHP plugins installed.

Installing the Zend Framework

First we are going to install Zend:

$ sudo apt-get install zend-framework-bin

This will also install the package: “libzend-framework-php”. It will not install the packages: “zend-framework” and “libzend-framework-zendx-php”. These packages are still available for installation.

The Zend library is installed in the directory: /usr/share/php/

Adding the Zend include to the webserver

I am using Apache2 locally as a webserver, we need to add parameter ‘include_path’ to php.ini:

$ vi /etc/php5/apache2/php.ini
include_path="/usr/share/php/libzend-framework-php"

To use Zend on the command line, you need to add the parameter ‘include_path’ also to:

$ vi /etc/php5/cli/php.ini
include_path="/usr/share/php/libzend-framework-php"

Now restart the Apache webserver:

$ /etc/init.d/apache2 restart

Configuring NetBeans for the Zend Framework

Now startup NetBeans and perform the following actions:

  1. Go to menu: Tools->Options
  2. Click on the PHP section
  3. Go to tab ‘General
  4. Click in the ‘Global Include Path’ section on the ‘Add Folder’ button
  5. Browse to the folder: /usr/share/php/libzend-framework-php
  6. Now click on the tab ‘Zend
  7. Click on the ‘Search’ button, in my case it came up with: /usr/bin/zf.sh, accept this by click Ok
  8. Now you can click on the ‘Register Provider’ button

Problems?

Check the NetBeans Output window for the result of the provider registration. In my case I had to do the following

I was getting the following errors:

Failed loading /usr/lib/php5/20090626+lfs/xdebug.so:  /usr/lib/php5/20090626+lfs/xdebug.so: cannot open shared object file: No such file or directory
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/curl.so' - /usr/lib/php5/20090626+lfs/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: include_once(NetBeansCommandsProvider.php): failed to open stream: No such file or directory in /usr/share/php/libzend-framework-php/Zend/Loader.php on line 146
Warning: include_once(): Failed opening 'NetBeansCommandsProvider.php' for inclusion (include_path='/usr/share/php/libzend-framework-php:.:/usr/share/php:/usr/share/pear') in /usr/share/php/libzend-framework-php/Zend/Loader.php on line 146
PHP Warning:  include_once(NetBeansCommandsProvider.php): failed to open stream: No such file or directory in /usr/share/php/libzend-framework-php/Zend/Loader.php on line 146
PHP Warning:  include_once(): Failed opening 'NetBeansCommandsProvider.php' for inclusion (include_path='/usr/share/php/libzend-framework-php:.:/usr/share/php:/usr/share/pear') in /usr/share/php/libzend-framework-php/Zend/Loader.php on line 146

An Error Has Occurred
File "NetBeansCommandsProvider.php" does not exist or class
"NetBeansCommandsProvider" was not found in the file

I found the NetBeansCommandProvider.php file in the installation directory of NetBeans, in my case installed in my /home/ directory:

$ cp ~/netbeans-6.9.1/php/zend/NetBeansCommandsProvider.php  /usr/share/php/libzend-framework-php/Zend

To remove the xdebug.so and curl.so errors, install the following packages:

$ sudo apt-get install php5-curl php5-xdebug

To do the registration again, first remove the Zend ini file:

$ rm ~/.zf.ini

Now do the Provider Registration again (start at step 7 of the NetBeans configuration steps)

Creating a new Zend project

When you are create a new project, you are able in the last steps to select ‘Zend PHP Web Framework’. A Zend project will be generated, the Include Path contains already the path to the include ‘/usr/share/php/libzend-framework-php’.

Now you should be able to run the public/index.php file like you normally do in NetBeans and will show the next screen.

Screen: Welcome to the Zend Framework
Screen: Welcome to the Zend Framework

The Zend Framework Quick Start guide

The Zend Framework Quick Start guide is handy if you are not known yet with Zend.

In this guide you will find commands like for example:

$ zf enable layout

You can perform this command in your NetBeans project directory from a shell without root permissions.

Remark: - The Quick Start guide will use a SQLite database, you need to install this for PHP:

$ sudo apt-get install php5-sqlite