My name is Clayton McIlrath and I am an entrepreneur currently living in CO. I personally enjoy the process of learning, exploring, and doing all things creative as well as sharing my experiences with others. Being an entrepreneur and business owner, I hope that my experiences may help someone else start their own venture and find success and freedom as I have! Feel free to contact me anytime for questions or opportunities.

close
more

»

«


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.

  1. Get MAMP up and running, no special setup is needed here.
  2. 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
    
  3. Now open your php.ini file located under /Applications/MAMP/conf/php5/php.ini
  4. 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

  5. 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
  6. Test if the Zend Tool is installed correctly by showing the version:
    zf show version
  7. 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

  • Great tutorial. I tried and failed many times on getting zend up and running. Im not knocking ZendCasts but heck this took me maybe all of 10 minutes to set-up versus about 2 hours of watching the ZendCast set up. It was painful to say the least. Quick question: Can I create an alias to mamp via command line? right now this is how I connect to it via terminal::

    cd /applications/mamp/Library/bin

    ./mysql -u root -p -P 3306

    Enter password: *****.

    There has got to be a better way. I would just like to enter 'mamp' via command line and I am connected. Thanks...
  • thinkclay
    I use this for my alias, and just put in the .bash_profile:

    mamp="/Applications/MAMP/Library/bin/mysql -u root -p -P 3306"

    So after that's created you can type mamp, hit enter, and pop in your password.
  • Works like a charm. Thanks again.
  • Nev Harrison
    Hey awesome tutorial!!

    I have one question for you..Whenever I close the terminal or open a new one and try to type a zf command; I get zf: command not found.

    It looks like I have to build the alias each time I want to use zend_tool.

    How would I save the following alias command to my system?
    alias zf=/Applications/MAMP/svn/zendframework/trunk/bin/zf.sh

    Thanks
  • thinkclay
    Hey Nev,

    To permanently add an alias to your "memory" just takes a little more terminal input:

    vi ~/.bash_profile
    hit "a" to enter "edit" mode, arrow down to the bottom and paste in your alias:
    alias zf=/Applications/MAMP/svn/zendframework/trunk/bin/zf.sh
    then hit the esc key and type "wa" (write all) and "q" (quit)

    That will save it in your shell profile of shortcuts (you can do this with many commands) and will be available even if you reboot. To get them to reload right away you can type in:

    . ~/.bash_profile

    Hope that helps and happy coding :)
  • Neveo
    Yes!! that did the trick..hey I grew up in CS next time I am home I'll look you up.

    Thanks again,
    Nev
  • Justn Cribb
    Hello! Thank you for this tutorial! I just have a question.

    If I was given a project built on Zend Framework, do I still have to install Zend on my MAMP for local development?

    I tested the project and it works fine...but there might be drawbacks I don't know. This is my first encounter with Zend Framework hehe. Would installing Zend Framework for local development necessary if I'm developing from an existing project that used Zend Framework?

    Thank you and pardon me for my ignorance at the moment :D
  • thinkclay
    If it's working already, then ZF is probably included locally in the project (usually linked to as "library" or something similar. If that's the case, you don't need to do anything further to update that project. This post mainly sets up an environment where ZF is included to all projects by default and accessible to multiple projects, thus saving on disk space and setup time.

    Hope that helps and good luck with your project!
  • Justn Cribb
    Yes...in the project there is a library/Zend folder. Thank you for clarifying this to me so I would not blame not installing Zend Framework on my MAMP if something weird happened in the development of the project haha! God Bless ^^
  • I spend one week, for installing ZF on my Mac. In internet lot of useless info :( But this post only working. Thx!
  • Dnakhla
    Great Tutorial, Thanks
close