Sunday 13 November 2016

Configuring And Installing Symfony


The recommended way to install new Symfony application is through Symfony Installer. This is a symfony application which helps you create new symfony application any number of times.

Enter following commands to your console to create new symfony project in your desired directory (Prerequisites : php must be installed in your system and php.phar extention must be enabled in your php configuration)

For Linux and Mac Users

$ sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony
$ sudo chmod a+x /usr/local/bin/symfony

For Windows users

c:\> php -r "readfile('https://symfony.com/installer');" > symfony

After executing above command move the downloaded symfony component  to your projects directory and execute following commands further

c:\> move symfony c:\symfonyProjects 
c:\symfonyProjects\> php symfony

Creating New Symfony Application

Creating/Installing new symfony application is pretty easy. Simply enter following command in your command line tool which will download all the required dependencies to run your project.


#Linux, Mac OS X Users
$ symfony new symfonyninja

#Windows Users
c:\> cd symfonyProjects/
c:\symfonyProjects\> php symfony new symfonyninja

#to create new symfony project with specific version you can simply write
$ symfony new symfonyninja 2.8
$ symfony new symfonyninja 3.1

Running Symfony Application

There are two ways of running symfony application:

1) By using inbuilt symfony console command

$ cd symfonyninja/
$ php bin/console server:run

After that simply type http://localhost:8000/ in your browser to see the Welcome page

2) By writing the absolute path of the project location from your localhost and appending it with /web/app_dev.php. Eg http://localhost/symfonyninja/web/app_dev.php

After following any of the above method you will get welcome screen as this



You must check for symfony configuration and setup before proceeding and rectify then if there are any issues. So type http://localhost:8000/config.php and follow the instructions before moving further.