Part #1 Install and Configure Symfony

Download and configure Symfony basics

Download Symfony Standard Edition from http://symfony.com/download
Uncompress it to your root folder (usually www) and you shoud get this structure:

app bin deps deps.lock LICENSE README.md src vendor web


Give writing permissions to cache and logs folders

chmod -R 777 app/cache app/logs


To check Symfony requirements run:

php app/check.php

You should get as much as OKs as possible


** Mandatory requirements **

OK Checking that PHP version is at least 5.3.2 (5.3.8 installed)
OK Checking that the \\\"date.timezone\\\" setting is set
OK Checking that app/cache/ directory is writable
OK Checking that the app/logs/ directory is writable
OK Checking that the json_encode() is available
OK Checking that the SQLite3 or PDO_SQLite extension is available
OK Checking that the session_start() is available
OK Checking that the ctype_alpha() is available
OK Checking that the token_get_all() is available
OK Checking that the APC version is at least 3.0.1



Recursive delete cache and logs content:

rm -rf app/cache/* app/logs/*


To empty cache, write logs and do some other actions you will need to give permissions to Apache:

chown -R www-data:www-data app/cache
chown -R www-data:www-data app/logs


Change www-data to apache or apache2 if needed your linux distribution.

If you haven\\\'t got root access then add:

umask(0000);


At the beginning of the files web/app.php, web/app_dev.php and app/console


If everything is alright then you should see the welcome page from your browser:
http://localhost/Symfony/web/app_dev.php

Click on \\\"Configure\\\" and set the database name and all the other parameters,
these parameters are stored in the file app/config/parameters.ini that can be used to manually configure the project

[parameters]
database_driver=\\\"pdo_mysql\\\"
database_host=\\\"localhost\\\"
database_port=\\\"\\\"
database_name=\\\"symfony\\\"
database_user=\\\"my_db_user\\\"
database_password=\\\"my_db_password\\\"
mailer_transport=\\\"smtp\\\"
mailer_host=\\\"localhost\\\"
mailer_user=\\\"\\\"
mailer_password=\\\"\\\"
locale=\\\"en\\\"
secret=\\\"25565668d3da26f15dda9a204a3fa5f03ba8e61\\\"


You may eventually create a virtual host


ServerName www.mysymfonyproject.com
DocumentRoot /home/my_folder/public/Symfony/web


DirectoryIndex app.php
Options -Indexes FollowSymLinks SymLinksifOwnerMatch
AllowOverride All
Allow from All
 


One database by project, as you can see, as Symfony 2 is an ORM (Object Relational Mapping) Framework if you want to use database mapping

[Back to Learn Symfony]