Updating Contao with Composer

by Thomas Urban

Contao CMS 4.x strongly relies on composer for managing its dependencies and for updating its components. You might always update manually by replacing files with a freshly released archive, but composer is supporting a more automatic way by intention. Using composer should ensure to update core components without loosing previously installed extensions or similar.

Here is a brief summary of steps taken to update your Contao 4.x installation:

  1. Connect to your web server using SSH or gain access on server's command line by equivalent means.
  2. Change into directory containing your installation of Contao. It is the one containing subfolders like web, app or vendor and the important files composer.json and composer.lock.
  3. Ensure composer is installed.
  4. Run: composer update
  5. After composer has finished on success you might need to open installation tool in web browser again to finish your update. If you keep getting an error page on trying to login into backend this might solve your issue. Just open http://yourdomain.com/install.php in your browser and follow instructions on screen.

Update of 2017-04-30

Upgrading from 4.0 to 4.3 was broken on selected sites and so starting fresh was required.

  • Backup all files in folders app/config, files and templates. Of course, you should backup all files of project for the sake of upgrading didn't work the way you expect it to do.
  • Remove all the files in your website's folder.
  • Start fresh there using command
    composer create-project --no-dev contao/managed-edition .
  • On entering database configuration use the data found in app/config/parameters.yml backed up before.
  • Open install tool in browser at URL http://yourdomain.com/install.php for upgrading database.
  • Copy all files given for backup before back to the website's folder.

Go back