Using Zend Framework with NetBeans IDE

I was messing about trying to get Zend Framework to work with  NB 6.5 Beta. I made many small mistakes, being a complete n00b to PHP, but with much help from the PHP team, I got the Official Zend Framework Quick Start to work. Some things I did and some mistakes I made are worth noting.
  • I created the project in my NetBeansProjects folder and had metadata saved to the same location, which was the default option. The Apache server cannot expose PHP files from there, so I had the sources copied to my Apache root directory, which in my case was XAMPP_HOME/htdocs. I could have created the project directly in XAMPP_HOME/htdocs, which was the default option. I have a ton of non-PHP projects though and like having all projects in the same directory.
  • I added the path to Zend libraries globally for all PHP projects, through the Tools > Options > PHP window.

    Alternatively, I could have added the libraries to the PHP include path of the individual PHP project, through the project's Properties window.
  • I created the folder structure as described in Official Zend Framework Quick Start, but I left out the /library folder because I thought that was taken care of when I added the Zend libraries to the IDE's global Include Path. Neither did I specify the path to the Zend libraries in bootstrap.php.

    I was wrong. The IDE's Include Path only enables libraries to be used in code completion. It does not pass the libraries to the Apache server. So I had to recreate the folder structure and bootstrap.php exactly as described in the tutorial, meaning that I copied the Zend libraries to the /library folder in my project and put that folder on the include path in bootstrap.php. I found that the IDE did not copy the Zend libraries from my project folder to XAMPP_HOME/htdocs/QuickStart/library--this may be a bug--so I had to copy them manually to that location, too. I am not sure that I need the libraries in my NetBeansProjects location or only in XAMPP_HOME/htdocs, but I have them in both locations to be safe.

    My final project structure looked like this:

  • Thanks to the complications of my directory structure, the final URL was http://localhost/QuickStart/public/index.php. In a proper PHP environment, this URL would be shortened by setting up a virtual host on Apache. However, I have not yet educated myself in how to do this.

Aside from these points, I was able to complete the Official Zend Framework Quick Start as it is written. Next I will try a more complicated Zend Framework tutorial.

 Note: Crossposted in my personal blog.

Comments:

This is great! I was just at zendcon last week and was inquiring at the Sun booth about this.

Thanks,
Kevin

Posted by Kevin Bond on September 23, 2008 at 12:47 PM CEST #

Thanks for the article & sharing your experience.
It's really helpful.

Btw, I tried the Official Zend Framework Quick Start link (http://framework.zend.com/wiki/display/ZFDEV/Official+ZF+QuickStart), but it displayed "Page not found" error.
I think the link may have been changed to http://framework.zend.com/docs/quickstart ?

Thanks

Posted by Yudi Setiawan on September 24, 2008 at 09:28 AM CEST #

Yes, indeed. We removed the old tutorial after making the migration to the main site. BTW, we always planned this migration, but I couldn't find the time for months. :( I hope you like the new QuickStart!

,Wil

Posted by Wil Sinclair on September 24, 2008 at 04:14 PM CEST #

"So I had to recreate the folder structure and bootstrap.php exactly as described in the tutorial, meaning that I copied the Zend libraries to the /library folder in my project and put that folder on the include path in bootstrap.php"

for an integration of the zend framework in netbeans I'd suggest to plan a setup that let the user keep the zend library folder outside the project folder so that he can share that folder with many projects in development environment..

you can still use the library folder changing a couple of defines in the index.php file (and maybe in bootstrap.php too)

example (index.php, line #5):
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/app/'));
set_include_path(
APPLICATION_PATH . '/../../../zf/library'
. PATH_SEPARATOR . get_include_path()
);

You should then have this code auto-generated from the netbeans wizard (please let the user choose whether to use absolute or relative path)

bye,
Giovanni.

Posted by Giovanni on September 25, 2008 at 05:36 AM CEST #

I started index.php

<?php
echo "Hello Zend Framework";

Then run a project and a box is opened with information
"Index file must be a valid file"

But if i check zend pages:
http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html

B.2.1. General

For files that contain only PHP code, the closing tag ("?>") is never permitted. It is not required by PHP, and omitting it prevents the accidental injection of trailing whitespace into the response.

Version of IDE:
Product Version: NetBeans IDE Dev (Build 200810031107)
Java: 1.6.0_07; Java HotSpot(TM) Client VM 10.0-b23

Posted by Tom on October 04, 2008 at 03:05 AM CEST #

My bad. It works now.
Sorry for bothering you.

Posted by Tom on October 04, 2008 at 03:14 AM CEST #

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Posted by links of london on October 29, 2009 at 08:28 PM CET #

I am new to netbeans and I am trying to get familiar with it. My question is, in netbeans when creating a new project, do I alway have to create the folder structure or it usually automatic create it when creating a project?

Posted by Hung Hoang on December 15, 2009 at 08:55 AM CET #

great ! but, is Netbeans can automatically create default Zend Framework folder structure too? thanks

Posted by simukti on January 19, 2010 at 12:52 AM CET #

Thank you for this article. It helps me on NetBeans code completion. Just add ZendFramework path to Global Include Path.

Posted by Nguyen Thanh Tung on January 21, 2010 at 09:32 PM CET #

nice post..I've just thought to switch from aptana to netbeans

Posted by deerawan on March 14, 2010 at 10:43 PM CET #

To avoid the silly long URL's you can set the Web Root by right clicking your project and clicking Properties.

Set this to the 'public' folder of your project and NetBeans will know to use http://localhost/index.php instead of http://localhost/public/index.php

Posted by Patabugen on July 19, 2010 at 07:01 AM CEST #

Thank you for this article. It helps me on NetBeans code completion. Just add ZendFramework path to Global Include Path.

Posted by guest on September 24, 2011 at 06:36 AM CEST #

Since NetBeans 6.9 of course you've been able to integrate the Zend Tool into NetBeans to create projects and execute commands.

Can be a bit fiddly to set up, so I put together a simple guide on it - http://www.webdevguides.co.uk/zend-framework/using-zend-framework-in-netbeans-ide

Posted by Dan on April 11, 2012 at 05:31 AM CEST #

I want to know procedure of installing zend framework in wamp.
I have zend framework folder but not has no library folder in it.
please mention the procedure to install zend in project and change in php.ini and if needed in apache or anything. please....

Posted by guest on February 05, 2014 at 08:03 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
About

This blogs is written by NetBeans developers who contribute to the PHP support mainly.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today