You must first sign up to be able to contribute.

Version 2 (modified by jamiel, 9 years ago)
Keep your dev environment functioning as normal

Original can be found on:

Install Symfony Framework over lighttpd


At end , our give a symfony framework instaled and working great.

Installing lighttpd web server

I install it via apt-get ( yes, during this tutorial i use debian gnu/linux with kernel 2.6.17 :-] ). Per default lighttpd run in port 80, but the idea it is a alternative web server installing it on port 81. If apache installed, please stop.

# apt-get install lighttpd

Now, lighttpd is installed on port 80, in soon our change this.ok!

Ps.: Slack Users, RedHat? like users, and users of others gnu/linux distros, please use distro oficial format to install lighttpd.

Installing needs to PHP

When compile PHP, it need a some libs instaled on system, like png, jpeg, zlib and others.

# apt-get install libpng12-dev libgd-dev libpng12-dev libjpeg62-dev zlib1g-dev libmysql++-dev postgresql-dev libpq-dev libpq4 libxml2-dev

All dev , indicate development package ( ak. headers ).

Note: libpq4 is to Postgresql 8.x and libpq3 is to 7.x

Obs: This a libs i need, maybe you need others, please, verify if ./configure return some error, and try install lib.

Some adjustments before compiling.

Go edit lighttpd.conf,

# vim /etc/lighttpd/lighttpd.conf

Find line server.port = 80 and change 80 to 81.

        ######### Options that are good to be but not neccesary to be changed #######

        ## bind to port (default: 80)
        server.port               = 81

        ## bind to localhost only (default: all interfaces)
        server.bind                = "localhost"

Ok, restart lighttpd and you can start apache again.

Now, verify http://localhost/ ( Apache Home ) and http://localhost:81/ (lighttpd placeholder )

Compiling PHP 5

Finally funny part! :-]

but, before start, 3 lessons

  • Gives attention in the messages
  • Gives MUCH attention in the messages
  • Don't scare with the messages

Download PHP

Enters in PHP Downloads area and download tar.bz2 of the stable version ( Complete Source Code).

Saves this archive in /tmp/


# tar - jxvf php-5.1.4.tar.bz2

will be created folder php-5.1.4 in /tmp, being /tmp/php-5.1.4/

# cd /tmp/php-5.1.4/

To configure Compilation

# ./configure --enable-fastcgi --with-gd --with-mysql --with-pgsql --with-zlib --with-pear=/opt/php5-cgi/pear --prefix=/opt/php5-cgi --with-libxml-dir=/usr/lib/

This, the bash ./configure way fastcgi ( --enable-fastcgi), compiles with gd, mysql, postgresql ( --with-pgsql) and zlib (compression library), parameter --to with-pear=/opt/php5-cgi/pear informs to install pear in the specified dir, --prefix=/opt/php5-cgi informs in which dir wants the installation of the PHP and for I finish we inform the way of libxml ( --with-libxml-dir=/usr/lib/).


If ./configure will have had success, compels and installs: # make && make install Now, va to take a coffee, to play play2, binds pra woman alone pra to give one oi, therefore make leads around 15 minutes to compile everything, make install is rapido, thing of 20 seconds and it it places the things in the place. (…) to after 15 you draft (…) It looks at that beauty. we have everything soon. it enters in the diretorio of installation, the scratch will have been followed sera /opt/php5-cgi/, and of one looked at.



It enters in the diretorio of the PHP: # /opt/php5-cgi

We now go to copy php.ini # cp /tmp/php-5.1.4/php.ini-dist /opt/php5-cgi/lib/php.ini

E clearly, we go to give a small one arranged to function as symfony: -) # I came /opt/php5-cgi/lib/php.ini Magic_quotes_gpc locates variavel of configuration, that it must be setada as On, modifies for Off being thus:

( ... ) ; Magic quotes will be incoming GET/POST/Cookie dates. magic_quotes_gpc = Off ( ... ) It uses to advantage and it locates tambem the section on session (: -]), descomente to var of config session.save_path and seven it stops /tmp, or dir that the PHP has writing right during the execution. ( ... ) ; octal where MODE is the representation of the mode. It notices that this ; you donate not overwrite the process's umask. session.save_path = “/tmp” ( ... )

: -), PHP now this prontinho to twirl!


It enters in the diretorio of configuration disponiveis. # compact disc /etc/lighttpd/conf-available

It edits the archive of configuration of fastcgi # I came 10-fastcgi.conf

Delete all the original conteudo, and leaves thus

#********************************************************************* server.modules += (“mod_fastcgi”)

to fastcgi.server = (“.php” =>

( "*" =>

(“socket” =>” /tmp/php5-fcgi.socket ",

“bin-path” =>” /opt/php5-cgi/bin/php "





After this, qualifies modulates it # lighty-enable-mod fastcgi

Opa, we go to give one restart in lighttpd # /etc/init.d/lighttpd restart

Rapido test, creates a /var/www/info.php archive (I am assuming that dir root is /var/www/) with the conteudo <? php phpinfo (); >, opens its navigator and points with respect to http://localhost:81/info.php, if to see that traditional screen with the information of the PHP, and to specify the version certinho with fastcgi. otimo, really everything left as waited, if not, it revises the steps.

Go Symfony, go!

We now go the installation of symfony, that sera installed way to pear.

First, we go for the direitorio bin of php. # compact disc /opt/php5-cgi/bin

Now, we bring up to date pear # ./pear upgrade PEAR

Beauty, hour to add the canal of symfony, ahhh, needs connection web is clearly (proxy will be being been using, export http_proxy= " http://ip:porta ") # ./pear to channel-discover

Finally we install symfony, in the case the beta (trunk/night-build) # ./pear install symfony/symfony-beta

We need to install tambem the Phing # ./pear install

Ok, now we go to correct a small detail, in case that voce has tambem another version of php installed, we will change executavel of php with respect to which symfony points. # I came /opt/php5-cgi/bin/symfony Being with the opened archive, it locates the line:

export PHP_COMMAND=php

It modifies stops:

export PHP_COMMAND=/opt/php5-cgi/bin/php

To finish we create one link for the binario of symfony # ln - s /opt/php5-cgi/bin/symfony /usr/bin/symfony

For forehead, it uses a keyboard in the terminal # symfony - T If to appear a list of options of symfony, ok, we are going well.

Symfony at lighttpd

Soon, we have everything to function, lighttpd installed, php compiled and symfony installed.

We go to create a folder for our project symfony of test # to mkdir /var/www/symfony-teste # compact disc /var/www/symfony-teste

We have the diretorio, now we go to create the structure # symfony new symfony-test It verifies the diretorio (ls - la) must have been bred one serie of diretorios (app, lib, date, web, and etc.)

We go to create one blog as application has tested # symfony app blog

E one I modulate Test #symfony modulates blog Test

We go to modify index padrao. #vim apps/blog/modules/Teste/templates/indexSuccess.php Codigo HTML places any, or modifies what ja exists.

Now the final test, to abrar the navigator, and points with respect to http://localhost:81/ ooopsss. It swims? it lacked some thing? Clearly, we need to inform lighttpd, for this opens lighttpd.conf again # I came /etc/lighttpd/lighttpd.conf Server.document-root locates config and modifies of what it will be stops server.document-root = “/var/www/symfony-teste/web/”

After it locates this part:

$HTTP [“host”] == “localhost” {

alias.url += (

“/doc/” => “/usr/share/doc/”, “/images/” => “/usr/share/images/”

) dir-listing.activate = “enable”


It changes stops: $HTTP [“host”] == “localhost” { alias.url += (

“/doc/” => “/usr/share/doc/”, “/images/” => “/usr/share/images/”, “/sf/” => “/opt/php5-cgi/pear/data/symfony/web/sf/”

) dir-listing.activate = “enable”


That is, we incluimos in the list of you unite the folder of symfony.

Now yes, it restarts lighttpd again, it opens the navigator and it points of this time with respect to http://localhost:81/blog_dev.php/Teste, voce must visualize the rederização of that archive that we modify previously.


He was this staff, any error or problem, order an email to me (domluc at gmail dot with), that I will answer rapido possivel.


  • Virtual Host for each project

Rewriting .htaccess to LightTPD

    alias.url            = (
        "/sf"           => "/usr/share/php/data/symfony/web/sf"

    url.rewrite-once = (
        "^/front_dev.php\/?([^.]+)$/" => 
        "^/(.*\..+(?!html))$" => "$0",
        "^/(.*)\.(.*)"        => "$0",
        "^/([^.]+)$"          => "/index.php/$1",
        "^/$"        => "/index.php"

To ensure your dev environment runs as normal add your app_dev.php to the rules.

    url.rewrite-once = (
        "^/front_dev.php\/?([^.]+)$/" => "/front_dev.php/$1",
        "^/(.*\..+(?!html))$" => "$0",
        "^/(.*)\.(.*)"        => "$0",
        "^/([^.]+)$"          => "/index.php/$1",
        "^/$"        => "/index.php"

Created in 07/08/2006 for Lucas Stephanou It finishes Alteration 08/08/2006

License GPL


If routing doesn't work and symfony defaults to match route [homepage] "/" then you should look closely at the output of phpinfo(): Most likely you have an empty $_ENV but $_SERVER is populated. Therefore you need to set this in apps/yourapp/config/settings.yml:

    path_info_array:        SERVER
    path_info_key:          ORIG_PATH_INFO

The second setting is what fabien wrote with respect to a unset $QUERY ticket:

cprior on Tue Oct 17 22:40:59 2017