OS X: How to Install Symfony into MAMP

Contributor Icon Contributed by David Kirk     
Tag Icon Tagged: Apple Mac  

Installing the open source php framework Symfony into an OS X box can be a challenge. By using MAMP and these directions, you will be up and running in no time.


MightyQ is becoming a jedi Symfony master. Just as I was getting skilled in plain ole php, he is now dragging me (correctly) into the world of Symfony. Here are the steps I used to get Symfony up and running in MAMP.

Now, I already had MAMP installed from my previous project of installing wp using MAMP in OS X.

If you do not have it, go ahead and download MAMP. Mount the MAMP dmg and drag the folder directly into your applications directory. Do not use a subdirectory.

Open the php.ini text file in a text editor. It should live here:

/Applications/MAMP/conf/php5/php.ini

Change the memory limit to 32M by editing the memory_limit part of the file to the following:

memory_limit = 32M ;

Save the file and close your text editor. Now fire up your terminal…

Now we are going to move leopard’s php to a safe place…

sudo mv /usr/bin/php /usr/bin/php-old

Link the MAMP php into where leopard’s php used to be…

sudo ln -s /Applications/MAMP/bin/php5/bin/php /usr/bin/php

If you have PEAR already installed, we are going to move it as well. If you don’t have PEAR, this will obviously error out which you can ignore.

sudo mv /usr/bin/pear /usr/bin/pear-old

Link MAMP’s PEAR into bin…

sudo ln -s /Applications/MAMP/bin/php5/bin/pear /usr/bin/pear

The following two commands will use PEAR to download and install symfony.

pear channel-discover pear.symfony-project.com
pear install symfony/symfony

Now place link symfony into bin…

sudo ln -s /Applications/MAMP/bin/php5/bin/symfony /usr/bin/symfony

If everything has worked correctly, you should now be able to fire up symfony from the command line.

Now that you have it installed, try working on the first symfony tutorial.

I originally got the majority of these directions from the following thread.

 

15 Comments -


  1. Cindy said on October 5, 2008

    AWESOME!!! Thanks for the info! Saved me hours!

  2. davak said on October 5, 2008

    No problem! Welcome to the world of symfony! It’s an amazing framework!

  3. Felix said on October 17, 2008

    Somehow it doesnt work, even though i followed everything and did not get any errors it always gives me “command not found” when i try to use any symfony commands like
    symfony propel-build-all-load

  4. Antonio said on December 1, 2008

    nice one! Thanks

  5. dave said on December 13, 2008

    Thanks a lot …. works great for me

  6. dave said on December 13, 2008

    symfony propel-build-all

  7. dave said on December 13, 2008

    or
    symfony propel-build-model
    symfony propel-build-sql
    symfony propel-insert-sql

  8. Keith Loy said on May 8, 2009

    Something you may want to add is a link to mysqladmin so that you can quickly setup databases from the command line as well.

    sudo ln -s /Applications/MAMP/library/bin/mysqladmin /usr/bin/mysqladmin

    is the line you’d do to do it.

    Thanks for the help by the way, I was having issues getting symfony installed through pear.

  9. Raúl said on May 21, 2009

    better with “sudo …”

  10. Chuck said on June 13, 2009

    Thanks. That was very very helpful

  11. Anonymous said on July 21, 2009

    I get a command not found on any symfony command I try. Any ideas?

  12. pieter said on January 13, 2010

    hi there

    very good tutorial! thanks a lot, saved me couple of hours/days

    I was wondering what these command lines do:
    sudo ln -s /Applications/MAMP/library/bin/mysqladmin /usr/bin/mysqladmin

    thanks!
    Pieter

  13. Flurdulis said on July 6, 2010

    I am getting permission denied when I try to run PEAR that is a symbolic link to a MAMP php5.3/bin/pear. Any solutions?

  14. LeadingLight said on July 16, 2010

    The executable bit is probably not set on the php and pear binary. Use these comands

    cd /Applications/MAMP/bin/php5.3/bin and use
    chmod +x php
    chmod +x pear

  15. wrightgd said on December 26, 2010

    I got everything installed correctly, but now I’m having a problem generating apps. I can’t help but thinking this might be somehow related to how the install locations/etc are different since I’m on a mac. Basically, when I run php symfony generate:app frontend in terminal, I receive no errors, but the directory structure the getting started tutorial describes is not created in the apps folder as it should be. Any ideas as to what might be causing this?

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -