01.11.2017

Contao: How to create a virtual system from your live website

Since a couple of year my sport club runs its website with contao.
Because our webhoster changed the support for php, i have to find a way to do an upgrade without damaging the running website.

The plan:
  1. create a linux host as a vm
  2. install mysql, apache2, php
  3. import the backups
The first step was easy. Inside virtualbox i created an ubuntu 17.10 system.
The second step was not that simple:
add-apt-repository ppa:ondrej/php
apt install mysql-server apache2 php5.6 php5.6-mysql
Importing the data into the database was easy (Before i did a backup via the contao frontend: system -> backup database).
mysql -u root -pYOURPASS -e "create database mydb"
mysql -u root -pYOURPASS mydb < database.backup.sql
From the live system i copied everything into /var/www/html and changed the user to www-data:
cd /var/www/html
chown -R www-data *
Last step is the customizing of /var/www/html/system/config/localconfig.php
$GLOBALS['TL_CONFIG']['dbHost'] = 'localhost';
$GLOBALS['TL_CONFIG']['dbUser'] = 'root';
$GLOBALS['TL_CONFIG']['dbPass'] = 'YOURPASS';
$GLOBALS['TL_CONFIG']['dbDatabase'] = 'mydb';
And after a last command
systemctl restart apache2
i was able to open the website via a local firefox with http://localhost/index.php.
Now a snapshot a damaged installation after an upgrade can be rolled back without any problem ;-)

1 Kommentar:

  1. EDIT:
    You have to install php5.6-gd as well. Otherwise php is not able to resize pictures...

    AntwortenLöschen