Konrad Podgórski - Web Developer

Personal blog about developing web applications with PHP

Ubuntu configuration for Symfony Developer

Please keep in mind that this post was written more than 2 years ago and might be outdated.

This is complete full instruction how to configure Ubuntu 11.10 / 11.04 fresh after installation to start developing with Symfony 2 Framework.

I haven’t tested it with Ubuntu 10.10 / 10.04 but it should work just fine.

Installation of lamp server

sudo apt-get install lamp-package^

now some required packages

sudo apt-get install php5-sqlite php5-intl

and optional but recommended

sudo apt-get install php-apc php5-xdebug

Required changes to php.ini

Remember to modify both php.ini files, /etc/php5/apache2/php.ini is for apache, second one /etc/php5/cli/php.ini is used for terminal commands

sudo gedit /etc/php5/apache2/php.ini

/etc/php5/apache2/php.ini ...

; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Europe/Warsaw"


Repeat this for /etc/php5/cli/php.ini

sudo gedit /etc/php5/cli/php.ini

Apache2 Modules

Now it’s time for apache2 modules, we will need to install mod rewrite

sudo a2enmod install rewrite

Restart Apache2

sudo service apache2 restart

Fixing permissions – ACL

This is very important step, without this either apache (while viewing in browser) or your user (while clearing cache from CLI) wont be able to write in cache and logs directories

First try this, if it won’t work read bellow, if it does – congratulations! You can skip this step

sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs

If above doesn’t work

sudo apt-get install acl

First we need to enable ACL support, to do this edit /etc/fstab file. You have to add “acl,” after “ext4″ and before “errors”. Please note that your fstab file might differ. Edit wisely!

Editing fstab to get acl working in ubuntu

Reboot computer for changes to take effect. Alternatively if you keep project files on partition other than system one you could remount it but restarting computer would be probably easier :)

Now commands mentioned in official book will work

sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs

more information about setfacl: http://symfony.com/doc/current/book/installation.html#configuration-and-setup

Other common problems

If you get following warning in terminal, please see this post

PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20090626/sqlite.so’





Find this post helpful? Spread the word, thanks.