Posted on Nov 12, 2008

Installing Symfony on Mac OS X 10.5.2

The purpose of this article is to simplify the installation process of symfony. Symfony installation can be a very tricky process and at some point might get very annoying that you might consider using another framework with an easy installation steps just like CakePHP. Symfony can be installed or used into two different ways:

  • PEAR installation(suitable for hosting that provides SSH access)
  • Sandbox installation(suitable for shared hosting with no SSH access, note: the name Sandbox here is not related to Sandbox Web Solutions)


But before describing the steps of each installation type lets first understand the difference between the two and which type is most suitable for your hosting plan or account after all, you will eventually publish your projects online. PEAR or PHP Extension and Application Repository is simply an online repository of PHP libraries, you can find Symfony and a lot more of PHP very good and time saving libraries on PEAR. But before using libraries from PEAR repository you need first to install PEAR and then download PEAR packages or libraries. The idea is simple you download Symfony as a PEAR package or library to your own PEAR installation(wither its local or online) and use the same library for multiple concurrent projects at the same time, this decreases your project overall size since you don’t include the actual Symfony libraries in the project which can increase uploading time as you’ll see in the Sandbox installation.

Sandbox installation on the other hand include the Symfony library in every project you use, so for example consider that you’re going to start 2 projects, and the Symfony library is simply a folder, then you’ll have to copy the Symfony folder to each project’s folder in order to use it. Some might think that Sandbox installation is a very bad idea, but i think that both installation are good enough if they are used wisely. So now that you have enough information to know the difference between the two installations (note: both installations will have almost all symfony features) and you probably have decided by now which one is more suitable for you(if you’re unsure if your hosting supports SSH access, then start with the Sandbox installation) then lets start the installation steps.

PEAR Installation

Mac OS X 10.5.2

This is by far the simplest form of installing Symfony as a PEAR package so lets the fun begins.
The process is divided into 3 steps:

  1. Installing PEAR
  2. Enabling PHP module in Apache 2 HTTP Server which is pre installed along with PHP in your Mac
  3. Installing Symfony 1.0.18
Installing PEAR

Open the terminal and follow the following steps(thanks to this source)

cd ~/
mkdir PEAR
cd PEAR
curl http://pear.php.net/go-pear > go-pear.php
sudo php -q go-pear.php

Press enter to select all the default choices and go ahead to the next step

sudo cp /etc/php.ini.default /etc/php.ini

If you’re asked for your account’s password enter it then continue to the next step.

mate /etc/php.ini

Now search for the following “; UNIX: “/path1:/path2″, it should be around line 468. Below this line you should find something similar to the following:

;include_path = ".:/php/includes"

modify the line above to match the following (note keep any paths you’ve added)

include_path = ".:/php/includes:/Users/YOUR_HOME_FOLDER_NAME/PEAR/PEAR"
Enabling PHP Module

Open your terminal

mate /etc/apache2/httpd.conf

Search for “php5_module” and remove the “#” from the beginning of the line if it’s available. Now restart the apache web server using the following command (note: enter your account’s password when prompted)

sudo apachectl restart
Installing Symfony

Now comes the easy part, close any terminal window opened and then open a new terminal window and type the following (note: enter your account’s password when prompted)

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

After PEAR finished installing symfony type the following to make sure everything is OK

symfony --version

You should now get the following output

symfony version 1.0.18

Pretty easy, you’ve now finished installing Symfony using PEAR on Mac OS X 10.5.2

1 Comment