contao-4-documentation

Some basic stuff for working with Contao 4

View the Project on GitHub jodermo/contao-4-documentation

Contao 4 - Local Development


Windows & Coposer

“The installer will download composer for you and set up your PATH environment variable so you can simply call composer from any directory.
Download and run Composer-Setup.exe - it will install the latest composer version whenever it is executed.”

Website & Download: https://getcomposer.org


Local Server (with XAMPP)

For Windows, I recommend XAMPP!

Contao has preconfiguration for XAMPP that worked very well for me.

“XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.”

Website & Download: www.apachefriends.org


XAMPP configuration for Contao 4

! Note: In this example, the XAMPP install path is c:\xampp\

PHP Configuration

Edit following lines in c:\xampp\php\php.ini

file_uploads = On
upload_temp_dir = "C:\xamp\tmp"
upload_max_filesize = 256M
allow_url_fopen = On
max_execution_time = 360
memory_limit = -1
post_max_size = 128M
extension=intl
extension=soap


Virtual Host

To make the local Contao project available with custom URL (e.g. http://contao-demo)
add following code to c:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
  DocumentRoot "<project path>\web"
  ServerName contao-demo
  <Directory "<project path>\web">
    Options +FollowSymlinks
    AllowOverride All
    Require all granted
  </Directory>

  ErrorLog "D:\xampp\apache\logs\contao-demo_error.log"
  CustomLog "D:\xampp\apache\logs\contao-demo_access.log" combined
</VirtualHost>


XAMPP & SSH

Open XAMPP Shell, type php -m to check if ssh module is already running.

Activate SSH in XAMPP:

First you need php_ssh2.dll in your XAMPP installation
Look for c:\xampp\php\ext\php_ssh2.dll.

If not, you can download php_ssh2.dll here: phpfashion.com/php-ssh2-dll-for-php-5-6-7-4
Pay attention to the right XAMPP installation (32bit or 64bit) and the installed PHP version.

Add following line to c:\xampp\php\php.ini

extension=ssh2

Then stop and start Apache, open XAMPP Shell and type php -m to check if ssh module is now listed.


XAMP, SSH & Virtual Host

To make the local Contao project available over SSH (e.g. root@contao-demo)
add following code to c:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost *:443>
    DocumentRoot "<project path>"
    ServerName contao-demo
    SSLEngine on
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>


Enter SSH

SSH on localhost (XAMPP default SSL port is 443)

ssh -p 443 root@127.0.0.1

SSH on Virtual Host (contao-demo)

ssh -p 443 root@contao-demo

(add -vvv to log output)


Documentation Overwiev

Troubleshooting

© 2020 by Moritz Petzka petzka.com