Friday, April 20, 2012

Symfony Setup In Simple Steps



1. Symfony installation
1. Download the Symfony zip file symfony-1.4.17.zip
2. Create project directory
mkdir sfprojects/jobeet
3. create lib/vendor directories inside project root
mkdir -p sfprojects/jobeet/lib/vendor
4. copy the downloaded ZIP to [project_root]/lib/vendor, unzip it and rename to symfony
cp [zip_name].zip sfprojects/jobeet/lib/vendor
unzip [zip_name].zip
mv [unziped_zip_name] symfony
rm -f *.zip
5. Verify the installation
php lib/vendor/symfony/data/bin/symfony -V


2. Project Creation
1. Generate the project using "symfony generate:project [project name]"
php lib/vendor/symfony/data/bin/symfony generate:project jobeet


3. Application Creation
1. Generate application using "symfony generate:app [app_name]"
php symfony generate:app frontend


4. Web Server Configuration
1. Adding Virtual host
In /etc/httpd/conf/httpd.conf, end of the file


<VirtualHost 127.0.0.1:80>
 ServerName www.jobeet.localhost.com


   DocumentRoot "/home/sfprojects/jobeet/web"
 DirectoryIndex index.php
 <Directory "/home/sfprojects/jobeet/web">
   AllowOverride All
   Allow from All
 </Directory>
 Alias /sf /home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf
 <Directory "/home/sfprojects/jobeet/lib/vendor/symfony/data/web/sf">
   AllowOverride All
   Allow from All
 </Directory>
</VirtualHost>


2. Adding host configurations
In /etc/hosts
        127.0.0.1 www.jobeet.localhost.com


5. Checking new configurations
Check the url in the browser www.jobeet.localhost.com