Upgrade Contao v3 to v4

Today I upgrade an Contao v3 installation to Contao v4.

Steps overview:

  1. Backup
  2. Setup local server with apache as docker container
  3. Migrate to v4
  4. Migrate code manually until page looks like in v3
  5. Move files to destination server

NOTE: Some steps below are explained very short, if you need more details please leave a comment and I will go more into depth for the needed step.

Workflow

  • Create a backup of the database and the files

  • Create a Docker container for mysql with image “mariadb”, optional with “phpmyadmin”

  • Create a Docker container for apache with “newdeveloper/apache-php” and expose a folder to /var/www/html

  • Create a subfolder /var/www/html/web

  • Import the database backup into mariadb

    • If you can not upload your file with phpmyadmin you can modify php.ini to increase the upload filesize with “upload_max_filesize = 5M”

  • Modify apache “docker exec -ti apache.1 bash”

apt-get update
apt-get -y install vim zip php7.2-intl php7.2-mbstring php7.2-soap

  • Set /var/www/html/web as DocumentRoot

vim /etc/apache2/sites-enabled/000-default.conf
DocumentRoot /var/www/html/web
service apache2 reload

  • Download contao-manager.phar /var/www/html/web
  • Rename contao-manager.phar to contao-manager.phar.php
  • Open: http://localhost/contao-manager.phar.php
  • Create a user
  • During system check change the server configuration to “other …”
  • Start the setup and choose the LTS version
  • IMPORTANT: Before you update the database move the directory files/* and templates/* to /var/www/html
  • “Confirm & Close” the installer
  • Install missing extensions
  • Copy old extensions to system/modules/

  • Open the installtool: http://localhost/contao/install

  • Fill in the database credentials

  • Update database but don’t drop tables

  • Create a symlink from folder „web/files“ to „files“, this was not generated during „system maintenance/symlink“

  • OPTIONAL: I need to change the following to fix the given page:
    • ID: Artikle ID’s are not used anymore from aliases to ID’s
    • Menu: The active link’s are moved from “<span>” to “<strong>”
  • After the page looks like before you can copy the files and the database to your provider. If you are getting into troubles about missing php you should run the contao-manager and set the path to php like described above.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top