Tags

, ,

Recently I have started Symfony PHP framework to learn.I am running a LAMP server in ubuntu 10.04 and learned how to set up the Symfony framework. If you are a beginner then this may help you.

Make sure that you have install pear if not installed yet just run this command

sudo apt-get install php-pear

Okay lets get started with Symfony. Below command will setup the channel where you are going to download Symfony using pear PHP module.

sudo pear channel-discover pear.symfony-project.com

sudo pear install symfony/symfony-1.4.6

Almost finished! You have installed symfony on your system for use. Now setup a sample project for personal use. In my case the project name is ‘symfony’. Lets make it. First go to the /var/www directory and make a folder named ‘symfony’. Now initialize a new project named ‘symfony’ and create a new front end (Using command will do it for you).

cd /var/www

mkdir symfony

cd symfony

creating project
symfony generate:project symfony

if you need to connect database run below command
symfony configure:database "mysql:host=localhost;dbname=dbname" username password

frontend creation
symfony generate:app frontend

Next we have to create a symlink this will allow the new project we created to use the Symfony libraries and elements installed earlier. With me you are still in /var/www/symfony

cd web/

ln -s /usr/share/php/data/symfony/web/sf/

That’s it. Now you can visit your site. Enter in browser address bar http://localhost/symfony/web/

If everything is okay then you will get the image below.

symfony

Symfony

Advertisement