Hands on Zend Framework is about a year or so. But earlier of my career I was confused about Frameworks. I’ve started with CodeIgniter then Symfony and now Zend Framework (ZF). At this stage of my career I’ve now decided to go with ZF. I don’t wanna argue here about frameworks but CodeIgniter is fine for get started, ZF is like supershop where you can find anything for your cook and Symfony was a bit complex for me but it is well organized with lots of features.
Okay going back to the point. To get started with ZF what you need?
- PHP 5.2.4 or higher
- Web server with mod_rewrite
Your Apache installation must have the mod_rewrite extension installed and configured to support .htaccess files.
This is usually done by changing this line
1 | AllowOverride None |
to
1 | AllowOverride All |
in httpd.conf.
Setting Zend_Tool
Download latest ZF from here. All we are interested about the Zend Framework Minimal Package.
- Extract the archive.
- Copy the contents of the folder to /usr/local/ via terminal
1sudo cp -r ~/Downloads/ZendFramework-1.10.6-minimal /usr/local/ZendFrameworkCli
- Open bash profile
1sudo nano ~/.profile
from terminal and add this line
1aliaszf=/usr/local/ZendFrameworkCli/bin/zf.shat the end of the file.
- Save and exit (press ctrl+x then hit y).
All set. Now if everything is okay, from terminal type
1 | zf --help |
. This will show all the commands available to ZF.
Creating our first project
We can now create project using zf command line tool as it’s easy, saves time and effort. So run this command in terminal
1 | zf create project kickstart |
The zf tool will create a directory called kickstart and populate it with the recommended directory structure as you can see below.

The application/ directory is where the source code for kickstart website lives. As you can see, we have separate directories for the model, view and controller files of our application. The public/ directory is the public-facing root of the website, which means that the URL to get to the application will be http://localhost/kickstart/public/. This is so that most of the applicationʼs files are not accessible directly by Apache and so are more secure.
Supporting images, javascripts, css files are stored in separate directories under public/ directory.
As everything is accessible from public so we have to set public folder as document root by creating a virtual host. If you don’t know how to create it please follow this post. Here’s a sample code I used to create virtual host.
ServerName local.kickstart.com
ServerAlias local.kickstart.com
DocumentRoot /Applications/MAMP/htdocs/kickstart/public
DirectoryIndex index.html index.htm index.php index.php4 index.php5
Options -Indexes +IncludesNOEXEC +FollowSymLinks
allow from all
AllowOverride All
Finally, we need to copy the Zend folder and paste it under our project library folder (library/Zend) or make a symbolink to /user/local/ZendFrameworkCli/library/Zend from library.
That’s it. Open your favorite browser any type http://local.kickstart.com if all okay you will see below picture.
Cheers!!! Happy coding.
N:B This article is tested on Mac OS X and hopefully same procedure will work on Linux server too. I will write soon about CRUD operation in Zend Framework in my next post. Stay tuned
Related posts:
2 Responses to “Get started with Zend Framework.”
Trackbacks/Pingbacks
- Get started with Zend Framework. | My Planet | EtondeGroup Blog of Web Applications - [...] Get started with Zend Framework. | My Planet Bookmark on Delicious Digg this post Recommend on Facebook share ...










Just a small edit you might need in #2.
Actually modifying AllowOverride None to AllowOverride All doesn’t refer to enable mod_rewrite. To enable mod_rewrite Linux (at least debs) needs to sudo a2enmod rewrite and windows users in XAMPP or WAMP have add
LoadModule rewrite_module modules/mod_rewrite.so in their httpd.conf file. And i don’t know about Macs much
AllowOverride All actually refers to Allow overriding server rules from .htaccess within web folders.
You may want to edit your post
Yeah you are right about mod_rewrite. But in MAC I used MAMP and it has mod_rewrite by default. I had to enable it.
Thanks for the comment.