Installing Symfony in Mac with MAMP

I installed XAMPP for Mac OS X and installed symfony, and tried to run my project. Then I found XAMPP does not have PDO_MYSQL support. So I tried to install it by pecl install pdo_mysql, however, I was ended up in some problem that I couldn’t fix easily. The first impression was that the path for the php header file was not correct. After a struggle to make it correct, I switched to MAMP (http://www.mamp.info/) and find the peace of mind.

  1. Install MAMP

    1. Put these directories in you path
    • /Applications/MAMP/bin/php5/bin
      1. Most files that will be frequently used is in /Applications/MAMP/bin/
  2. Install Symfony using peardev (to bypass the memory limit exceeding problem)

    1. sudo /Applications/MAMP/bin/php5/bin/peardev channel-discover pear.sy mfony-project.com
    2. sudo /Applications/MAMP/bin/php5/bin/peardev install symfony/symfony
  3. Setting up Symfony

    1. Edit apache configuration file at /Applications/MAMP/conf/apache/httpd.conf
    2. Refer Symfony Documentation Chapter 3
    3. An example virtual host configuration

        <VirtualHost *:80>
          ServerName myapp.example.com
          DocumentRoot "/home/steve/myproject/web"
          DirectoryIndex index.php
          Alias /sf /Applications/MAMP/bin/php5/lib/php/data/symfony/web/sf
          <Directory "/Applications/MAMP/bin/php5/lib/php/data/symfony/web/sf">
            AllowOverride All
            Allow from All
          </Directory>
          <Directory "/home/steve/myproject/web">
            AllowOverride All
            Allow from All
          </Directory>
        </VirtualHost>
    

    1. set $sf_symfony_lib_dir as /Applications/MAMP/bin/php5/lib/php/symfony
    2. set $sf_symfony_data_dir as /Applications/MAMP/bin/php5/lib/php/data/symfony
    3. Checkout Symfony project
    4. Let svn to ignore cache and log directory

        chmod 777 cache log
        svn propedit svn:ignore cache
        svn propedit svn:ignore log
    
  1. I’m using Doctrine as my ORM layer, and PHP CLI seems not working correctly, yet the web was okay. symfony doctrine-insert-sql complained that “doctrine couldn’t locate mysql driver.” It turned out, Mac OS X has php binary in the /usr/bin/ directory. So I put the MAMP bin directory in the path prior to existed path variable.

6 Responses to “Installing Symfony in Mac with MAMP”

  1. rpsblog.com » A week of symfony #28 (09-&gt;15 July 2007) Says:

    […] Installing Symfony in Mac with MAMP […]

  2. Andy Says:

    “Edit apache configuration file at /Applications/MAMP/conf/httpd.conf”

    For me I had to use /Applications/MAMP/conf/apache/httpd.conf

    Not sure if anybody else has that change as well.

  3. sunhwan Says:

    Thanks, Andy. You are right. I’ve changed the typo. Thanks again.

  4. Instalando Symfony en Mac OSX Says:

    […] problema viene con Symfony. IntentĂ© instalarlo tal como lo describen en esta web, pero, primero por mi inexperiencia con Mac, y despuĂ©s por diferentes errores enlazando […]

  5. Wahoo Says:

    Thank you for sharing!

  6. Simon Plenderleith Says:

    Thanks for that, helped me get things sorted with Symfony CLI :D

Leave a Reply