Installing Zend Framework on MAMP
As usual, I’m sharing a solution a problem that I personally encountered and couldn’t find a great solution for. So I’ve been using my laptop more and more as my local development environment in order to keep things private and secure while in the dev stage. Among learning how to fully utilize SVN locally, I’ve been trying to setup my laptop to be a fully functional server while also being extremely easy to maintain and change my environment on the fly. To do this, I’m running MAMP (Mac Apache MySQL PHP) available for free at mamp.info as well as the Zend Framework bundled with Zend Tool.
- Get MAMP up and running, no special setup is needed here.
- Download Zend Framework and place it wherever you’d like. I actually retrieved my copy via SVN so that I can easily upgrade it later. To do this open up terminal and follow these commands:
cd /Applications/MAMP/ mkdir svn cd svn mkdir zendframework cd zendframework svn checkout http://framework.zend.com/svn/framework/standard/trunk
- Now open your php.ini file located under /Applications/MAMP/conf/php5/php.ini
- Search for include_path (around line 411 on mine) and add the location of your zend framework:
include_path = ".:/usr/lib/php:/usr/local/lib/php:/Applications/MAMP/svn/zendframework/trunk/library"
Make sure to include the library directory otherwise you’ll get a blank page in Zend Framework
- Zend Framework also comes with a shell script that will help you with RAD (Rapid Application Deployment), you can create a shortcut to Zend Tools in terminal by adding an alias to your profile under /etc/profile (thanks DS for pointing this out) and make sure to restart terminal after you’ve done so:
alias zf=/Applications/MAMP/svn/zendframework/trunk/bin/zf.sh
- Test if the Zend Tool is installed correctly by showing the version:
zf show version
- Finally navigate to the directory you’d like to create your first project in:
cd /Applications/MAMP/htdocs/
and with Zend Tool creating a project is simple:
zf create project test


This is great info. A lot less complicated than other options I’ve seen people attempting to explain. I did have to tweak it as all of your suggestions didn’t work though. I did made the following variations:
- Download the full framework from http://www.zend.com/community/downloads
- Created /Applications/MAMP/zfw
- Copied the uncompressed framework into /Applications/MAMP/zfw
- Edited php.ini and added the following line to include_path: “/Applications/MAMP/zfw/library”
- Used this to make the alias: alias zf=/Applications/MAMP/zfw/bin/zf.sh
…and that’s it. When I did the SVN version it didn’t include the zf.sh file or the bin folder.
Thanks again, these things are always changing so I thought another newbie like myself might find this useful
Cheers
Thanks for documenting your process. I may have done something differently or already had the Zend Tools enabled from a previous attempt, so I really appreciate the correction and outline of your process.
Have you dove into Zend much yet? I’ve flooded my brain with it in the last week (DB handling, Form generation and Mail so far, attempting to tackle REST tonight)
Nope, just getting up and started with it right now. Hopefully I’m going to fall in love because I deserted Python to come to PHP and all its web-oriented goodness and miss Python dearly. Anyway….
I just noticed that the alias command we both gave won’t stick unless you add it to your profile. So you could add this command into your list of directions maybe:
- In Terminal enter: edit /etc/profile
- Add the line: alias zf=/Applications/MAMP/zfw/bin/zf.sh to the end
- Restart Terminal and switch to the directory you wish to make your project in
- Enter “zf create project [project_name]” or other zf.sh command
Not sure if you had to add the alias to your bash shell but I don’t think it will work if you don’t unless you copy an alias to something in your root path…is that right? Did it just work for you?
Cheers.
Python is a beautiful language and PHP syntax will make you miss it even more, but at least frameworks like Zend make it easier and faster and it really is does dominate the web.
I don’t recall having to add this to my profile, but I did read that elsewhere so it may be worth noting. I’ll do some more research on it with a computer I haven’t tweaked so much.
Good call DS, i added local profile bit into my post and gave credit to ya. Thanks!
An interesting post, I think. Hope that there are more I can read from this site. I will note it in my notebook. thank you.
Glad to have made the process a bit more fluid.
PHP syntax isn’t horrible but Python is just sooo clean and sooo logical. It’s okay, PHP is not as bad as some other options out there.
Cheers
Hi Clay,
Install seemed to go well. Great tutorial.
However, how do I start to use the framework?
I’m not sure how to set up a virtual host on MAMP. Would this be in my httpd.conf file?
How do I do this?
I think once this is set up, I’m all ready to go
Many thanks for any pointers.