How to run your Symfony application on Ubuntu Xenial

This article explains the differences I found between Trusty and Xenial to run a Symfony application.

So what’s new in the latest Ubuntu LTS release? On the application side we have:

  • PHP 7.0
  • Nginx 1.9.15
  • Python 3.5
  • Postgresql 9.5
  • Mysql 5.7.11
  • Mongo 2.6.10
  • Docker 1.10

This nice DigitalOcean post provides a great overview.

From Trusty to Xenial

My goal was to run the default project from the Symfony installer on a Vagrant VM.
I also wanted to be able to use Mysql, Postgresql or Mongodb.
I explain below, all the steps I needed to do so.

First I ran: symfony new xenial64 to quickly get all the Symfony files.
Then I looked for the official Vagrant box of Xenial and found it here.
My next step was using my Ansible playbook generator to get a first draft of a provisioning.
I updated the Vagrantfile to use the right Vagrant box
and I ran vagrant up.
Unfortunately an error occurred and I wasn’t the only one.

As I didn’t want to wait for the next release of Vagrant, I moved away from the official box
to an unofficial one.
It worked without any error this time.

I then launched the provisioning with ansible-playbook devops/provisioning/playbook.yml -i devops/provisioning/hosts/vagrant and met my first
errors during the PHP role.

Changes related to PHP.

I needed to update the role as we are now using PHP 7.
I manually installed all the PHP packages needed, as I didn’t know their name, this
page was very useful.

Here is a short list:

- php
- php7.0-mysql
- php7.0-pgsql
- php7.0-mcrypt
- php7.0-curl
- php7.0-dev
- php7.0-gd
- php7.0-ldap
- php7.0-sqlite3
- php7.0-intl
- php-apcu

Note that the PHP conf files has also slightly changed their location from /etc/php5 to /etc/php/7.0.

Symfony3 requirements

Changes related to Nginx

Everything went well except that the php-fpm socket has changed from /var/run/php5-fpm.sock to /var/run/php/php7.0-fpm.sock.

Changes related to Mongodb

Things are now much simpler than before because a apt-get install mongodb is now enough to install Mongodb.


No problem =)


I had one issue with the /etc/mysql/my.cnf configuration file. It has been splitted into different files so it’s a little bit harder to set the right configuration.
Otherwise everything was OK.


And this is it, if you want to try by yourself everything is here.
Symfony3 xenial
You will find a Vagrantfile, an Ansible provisioning and the Symfony files.

If you want to know more about Xenial, here are some useful links:

Don’t hesitate to share with us the best links you found. If you have questions, you can ask me on twitter.

You liked this article? You'd probably be a good match for our ever-growing tech team at Theodo.

Join Us

  • Muhammad Taqi Hassan Bukhari

    Hi I used the same box you mentioned; got error on config networking;
    — vagrantfile

    Vagrant.configure(2) do |config| = “geerlingguy/ubuntu1604”
    config.vm.box_url = “”
    config.vm.hostname = vm_hostname “private_network”, ip: “”


    ==> default: Setting hostname…
    ==> default: Configuring and enabling network interfaces…
    The following SSH command responded with a non-zero exit status.
    Vagrant assumes that this means the command failed!
    /sbin/ifdown eth1 2> /dev/null
    Stdout from the command:
    Stderr from the command:
    mesg: ttyname failed: Inappropriate ioctl for device

  • Maxime Thoonsen

    Hi Muhammad,
    Sorry for the very late response, I didn’t see your message. I think now the problem has been solved if you use the latest Vagrant version

  • HI, Yes it works with Vagrant v2.0 but not with v1.8.