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:
- Download and install Xcode from the App Store. (current release 4.3.3).
- Download and install the Command Line Tools for Xcode from Preferences > Downloads in Xcode.
- 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:
Step 3: Get the extensions
- Open your Terminal by either pressing both [⌘ + space] and writing Terminal or from the filesystem
/Applications/Utilities/Terminal.app
and type:
or if you have PHP 5.4.X (thanks to Andrew Knight):- sudo port install php5-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 install php54-intl
- sudo port -d sync
- Get yourself some tea and try to gather some reputation on Stackoverflow. This is going to take some time.
- 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 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:- open .
/Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-yyyymmdd/
Step 4: Do the configuration
- Navigate to the following directory (via Finder and assuming with PHP 5.3) to change a few settings:
/Applications/MAMP/conf/php5.3/
- 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 - Now save and move the file back to it’s original directory. Now restart your web-server (via Mamp).