Symfony 2. Migration project to php 7 from php5.5. Performance issues Symfony 2. Migration project to php 7 from php5.5. Performance issues symfony symfony

Symfony 2. Migration project to php 7 from php5.5. Performance issues


Few steps to optimize PHP code globally and for PHP7 :

  • composer selfupdate
  • composer update
  • composer dumpautoload -a
  • activate zend opcache (or any other installed php opcache)
  • in php.ini :
    • opcache.max_accelerated_files=20000 (or more)
    • opcache.validate_timestamps=1
    • opcache.revalidate_freq=10 (or more)
    • xdebug.default_enable=0
  • restart php-fpm7 service

If performance issues still persist, profile your typical test page with blackfire.


The reason of this will surely be the xdebug. Please turn it off and then check the performance.

I have to point out that in our case after switching from PHP5.5/Symfony 2.0 to PHP7/Symfony 3.0 we did encountered a performance drop. This was caused by how Symfony 2.8+ handles the php sessions. It stores them in a local directory instead of standard /tmp directory which almost always stored in RAM. So if you have pretty big count of session files the search of the file from HDD takes a long time compared to RAM.

After removing this in Symfony config, the application started showing the performance gains we hoped for.