How to Install Symfony on Macbook (yosemite)

Install Symfony on Yosemite Macbook Pro

Web Development with PHP is quite a task but with the tools available, its much easy to focus on the Content rather than the Coding.. Symfony & Doctrine are two such tools available for Web Development in PHP.

Installation for both Symfony & Doctrine is a bit complex for newbie / startup, hence the tutorial to get you started. I have used many of the existing tutorials links instead of rewriting the same. This Tutorial is for Macbook Pro with OS X (Yosemite)

1. Install HomeBrew /* Required to install Unix software not available on OS X */
2. Install Composer /* to install dependency Manager for PHP */
3. /* PHP is by default installed on Macbook */
4. Install PEAR /* PEAR is required to install PHP Extensions using PECL */
5. Install MySQL
6. Enable Virtual Host /* webserver is disabled by default in Yosemite */
7. Install Symfony /* also installs the Doctrine */
8. Test & Configure Symfony

Step 1: Install HomeBrew:
Step 2: Install  Composer:
Step 3: Install PEAR:
Step 4: Install MySQL:
Step 5: Edit php.ini:
Step 6: Enable Virtual Host:
Step 7: Configure for Symfony Installation:
Step 8: Install Symfony with Doctrine:

We are now Ready to Install Symfony, Just follow the steps in the Terminal

> composer.phar create-project symfony/framework-standard-edition Symfony
/* you will be prompted for inputs for configuration "JUST Press Enter" to accept the defaults; */
/* We will configure these later */
> composer.phar create-project symfony/framework-standard-edition Symfony
/* you will be prompted for inputs for configuration "JUST Press Enter" to accept the defaults; */
/* We will configure these later */

You should get the following

We will configure the above options later: Let edit the Local Host in the terminal

> Sudo nano /etc/hosts
> Enter the following
127.0.0.1       smfony.dev

Step 9: Install Test & Configure Symfony:

We have installed Symfony, Now we have to test and configure by following the steps below

Step 9 (a): open in browser http://symfony.dev/config.php

Step 9 (b): Fix the Major Problems
We have change permission for the cache & logs folders. (copy paste to terminal )

> cd ~/Sites/Symfony
> sudo chmod -R 0777 app/{cache,logs}
> sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/{cache,logs}

click “Re-check Configuration” the Major Problems should not be there

Step 9 (c): open in browser http://symfony.dev/config.php

Step 9 (d): Lets Configure; Open in browser
http://symfony.dev/app_dev.php and click the “Configure”
Tab We are now access the acme demo bundle
(Pls ensure that the MySQL installed in Step 4 is Running )

Step 9 (e): Click “Next” & Copy the Secret Number

Step 9 (f):  click “Next”, either it write’s to
/Users/tsk/Sites/symfony/app/config/parameters.yml:
or throws the following exception

Step 9 (g):  Check the “parameters.yml” file for the configurations.. (we would require the “Secret Number” copied earlier)

> sudo nano /Users/tsk/Sites/symfony/app/config/parameters.yml 
/* Filling the Values for Items Marked in RED */

Note: I use the Gmail for Email and I am always connected to Internet.. hence

mailer_host: smtp.gmail.com
mailer_user: username@gmail.com
mailer_password: gmail_password

This Completes the Installation: Next We will Learn “how to use Symfony in Project”