Wednesday, May 28, 2014

Tutorial on install, setup and getting started in Symfony 2 PHP MVC framework with Hello World example on Windows

PHP is one of the widely used web development language, and Symfony is an Enterprise level PHP MVC framework. Here I am explaining the steps for getting started with Symfony in Windows with a 'Hello World' example in Symfony.




Download and install XAMPP - https://www.apachefriends.org/download.html


After Installation is completed, Check whether it is working by starting Apache, MySQL in the XAMPP control panel.


The XAMPP folder will have the below folders. In this 'htdocs' will be the website directory.


Goto http://symfony.com/download and download the latest standard edition without vendors.


Extract the downloaded archive and place the 'Symfony' folder in '<path>/xampp/htdocs/Symfony' as below.


Open command prompt and check whether php is executable by typing 'php -v' in cmd prompt.


If it is not added, Copy the '<path>/xampp/php' directory path and add it to the environment variables by going to 'My Computer -> Properties -> Advanced -> Environment Variables -> Path -> Edit'



Now execute 'php -v' in command prompt. It should display version number as given below.


To install composer, Go to https://getcomposer.org/download/ and copy the highlighted line.


In command prompt, go to the location <path>/xampp/htdocs/Symfony and paste the copied line (given below) and enter.
php -r "readfile('https://getcomposer.org/installer');" | php


After composer is installd, there will be 'composer.phar' file downloaded in the 'Symfony' directory.


Now, go to <path>/xampp/php and open the php.ini file.


Uncomment the line extension=php_openssl.dll ( Simply remove the ; in the start of the line ) from the file to enable openssl.

Now Stop & Start the Apache so that the configuration changes take effect.

Now, go to <path>/xampp/htdocs/Symfony in command prompt and run the below command.
php composer.phar update
It will download the required packages for Symfony to run. The download library list will be present in composer.json file.



After the composer has run successfully, There will be a 'vendor' folder downloaded into the 'Symfony' folder. This will be having all the Symfony framework files.


No go to http://localhost/Symfony/web/app_dev.php
The symfony hello world demo will be running in the URL.


2 comments:

  1. nice one ! and still post many on symphony

    ReplyDelete
  2. Share or Provide your details, styles, identifiable, 3d styles, performs of art, pictures, etc., generate income, and get used globally. Sign-up via e-mail or your team press issue here:http://www.ehuub.com/login/ by selecting classification "GRAPHICS, DESIGN, AND MULTIMEDIA", thank you!

    ReplyDelete