Symfony

Notes:

Why MAMP ? Because it’s the easiest way to work locally with Symfony 2 at the moment. It comes with an updated APC extension and requires only the INTL extension which we will compile in this how-to. Please follow the requirements and instructions step by step.


Requirements:

  1. Download and install Xcode from the App Store. (current release 4.3.3).
  2. Download and install the Command Line Tools for Xcode from Preferences > Downloads in Xcode.
  3. Install Macports. Follow the instructions on Macports

Step 1: Get the Web-Server

Go to Mamp and download the current version of MAMP. After installing delete the MAMP PRO directory (you won't need it) and run MAMP.

In the window click on Preferences… then on Ports. There change the current server ports to their default ports. MAMP will automatically restart both servers so we can finally start setting up Symfony 2.


Step 2: Get the framework

Go to Symfony and download the current release (2.1.3). Unpack it and move the Symfony folder to your local htdocs which is located in: /Applications/MAMP/htdocs

Now we will configurate our web-server to make Symfony 2 work. Open the following URI in your Browser: http://localhost/Symfony/web/config.php

You will most likely get something like this:

Symfony Recommendations


Step 3: Get the extensions

  1. Open your Terminal by either pressing both [⌘ + space] and writing Terminal or from the filesystem /Applications/Utilities/Terminal.app and type:
    sudo port install php5-intl
    or if you have PHP 5.4.X (thanks to Andrew Knight):
    sudo port install php54-intl
    In case you get the warning that no indexes could be found run the following line and then try the upper command again:
    sudo port -d sync
  2. Get yourself some tea and try to gather some reputation on Stackoverflow. This is going to take some time.

  3. Type the following into your Terminal and press [tab] for auto-completion - then [return]:

    cd /opt/local/lib/php/extensions/no-debug-non-zts-
    Now your are located in the directory where our extension has been compiled (via Terminal). Type:
    open .
    Now your Finder is going to popup just where our intl.so extension is located. Copy that file and put it into your MAMP php-extensions directory. For PHP 5.3 it would be:
    /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-yyyymmdd/


Step 4: Do the configuration

  1. Navigate to the following directory (via Finder and assuming with PHP 5.3) to change a few settings: /Applications/MAMP/conf/php5.3/

  2. Now drag the file php.ini onto your desktop (where you can edit it) an open it with your favorite text editor. I did the changes with the default editor TextEdit.

    [⌘ + F] and search for short_open_tag and change it to off.

    [⌘ + F] and search for magic_quotes_ and add the following line after: magic_quotes_sybase = off
    magic_quotes_gpc = off

    [⌘ + F] and search for 'extension=apc.so' and add the following line to the extensions section:
    extension=intl.so

  3. Now save and move the file back to it’s original directory. Now restart your web-server (via Mamp).


Step 5: Let's Symfony !

Enjoy the newest release of Symfony 2 on a fresh and up-to-date Mamp web-server.

Symfony Success


Final words / future updates

If you guys have any issues while following this guide please post your problems so we can solve them.

Apart from that I'm going to write a little update soon in which I'm going to use homebrew instead of macports for all you people who abandoned the good old port.

You can't wait huh? Here's a fresh guide doing all of it using homebrew: Symfony and Mamp a love story



blog comments powered by Disqus

Published

2012-06-16

Categories


Tags