Using Zend Framework with NetBeans IDE
By Jeffrey Rubinoff on Sep 23, 2008
- 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.