Personal tools
You are here: Home GNU / Linux Debian 4.0 Etch Install Symfony on Debian 4.0 Etch
Document Actions
  • Send this page to somebody
  • Print this page
  • Add Bookmarklet

Install Symfony on Debian 4.0 Etch

by Pierre-Yves Landuré last modified 2009-10-17 08:56

Symfony is a powerful PHP 5 framework that ease development of PHP applications. This article help you to install Symfony on Debian 4.0 Etch.

First, you need to login as the root user. This can be done by using this command :

su -

Install of needed packages

The first step is to install a GLDAP environment (GNU / Linux Debian - Apache 2 - PHP). In order to achieve this, run this command line :

apt-get install libapache2-mod-php5 php-pear php5-mysql php5-cli php5-xsl

Don't forget to enable the Apache 2 rewrite module :

a2enmod rewrite

To install Symfony, you need to rise the memory limit for the PHP command line interpreter :

sed -i -e 's/memory_limit = .*/memory_limit = 32M/' /etc/php5/cli/php.ini

You also need to rise the memory limit for the PHP module of Apache 2 :

sed -i -e 's/memory_limit = .*/memory_limit = 128M/' /etc/php5/apache2/php.ini

Then you need to disable the PHP magic quotes option :

sed -i -e 's/magic_quotes_gpc = .*/magic_quotes_gpc = Off/' /etc/php5/apache2/php.ini

Installing Symfony

Before installing Symfony, you need to upgrade PEAR. This can be done by running these command lines :

pear channel-update
pear upgrade PEAR

You can now install Symfony. In order to do this, register the Symfony chanel into your PEAR configuration :

pear channel-discover

Now, we download and install Symfony :

pear install symfony/symfony

Then, we install phing (I don't know if it is really needed) :

pear channel-discover
pear config-set preferred_state beta
pear install --alldeps phing/phing

Note : If you want to be able to generate automatic documentation, you need to install PhpDocumentor :

pear install PhpDocumentor XML_Beautifier

Now, check that Symfony is installed :

symfony -V

If this command line work, you have now a working installation of the Symfony framework. The last thing to do is to create a place where coding your projects :

mkdir /home/sfprojects
chgrp users /home/sfprojects
chmod ugo+w /home/sfprojects

Symfony project creation

For the example, we create a new Symfony project. You can do this with your usual user. First, choose a name for your project :


Then create it :

mkdir /home/sfprojects/$SYMFONY_PROJECT
cd /home/sfprojects/$SYMFONY_PROJECT
symfony init-project $SYMFONY_PROJECT

Once the project created, we can create applications, In order to achieve this, choose the name of your application :


And create it :

cd /home/sfprojects/$SYMFONY_PROJECT
symfony init-app $SYMFONY_APP

Now, we create a associated Apache 2 web site :

su -c "echo '<VirtualHost *>
DocumentRoot \"/home/sfprojects/$SYMFONY_PROJECT/web\"

Alias /sf /usr/share/php/data/symfony/web/sf

<Directory \"/home/sfprojects/$SYMFONY_PROJECT/web\">
AllowOverride All
</VirtualHost>' \
> /etc/apache2/sites-available/$SYMFONY_PROJECT"

Don't forget to enable it :

su -c "a2ensite $SYMFONY_PROJECT"

Check you Apache 2 configuration :

su -c "apache2ctl -t"

If it is allright, reload the Apache 2 configuration :

su -c "/etc/init.d/apache2 reload"

Now, we add a line to our hosts file in order to access easily to our project :

su -c "echo ' $SYMFONY_PROJECT' >> /etc/hosts"

You can now start to work on your Symfony project. Use this command line to open it in your browser :

firefox http://$SYMFONY_PROJECT

What's next

Now that you have installed it, i encourage you to follow this 24 tutorials to learn the use of Symfony.

Upgrading Symfony

If you want to upgrade Symfony, use these command lines as a super user :

pear channel-update
pear upgrade --alldeps PEAR
pear channel-update
pear upgrade symfony/symfony

You can also upgrade all PEAR packages :

pear update-channels
pear upgrade-all

Now, for each Symfony project available on your computer, run (if necessary) :

symfony upgrade

Generating documentation

If you have installed PhpDocumentor, you can generate your project documentation by using the command line :

phpdoc -d /home/sfprojects/$SYMFONY_PROJECT -t /home/sfprojects/$SYMFONY_PROJECT/doc



Greate guide

Posted by J Liang at 2008-07-06 23:14
it's very clean and no error, it's a great guide for a new symfonyer :)


Posted by Baljinder Singh at 2008-12-08 09:39
good article.. great help to beginners

Great Thanks

Posted by Nhomar at 2009-02-16 01:36
I hope that you follow in this way... thanks from Venezuela.


Posted by walid at 2009-11-13 08:53
great guide !


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: