In this tutorial the setup of a local development environment under Windows is described using Laragon as an example.
With Laragon WAMP a local software stack consisting of the following server components is installed:
The installation package also includes other useful tools, which will not be discussed here, but you can find more information about Laragon (installation, features, etc.) in the official documentation.
Windows 7, 8, 8.1, 10
This manual describes how to install Laragon on Windows 10 (64-bit).
The security concept of current Contao versions (specifically Contao 4.x and higher) requires that symbolic links (symlinks) have to be created for the proper operation of the web application. However, creating symlinks under Windows usually requires administrator rights. It is therefore recommended that the ordinary Windows user also be granted the appropriate right to create symlinks. The easiest way to do this is to use the free Polsedit tool. The ZIP archive contains both a 32-bit and 64-bit version of Polsedit and can be run directly without installation.
ToDo: Configure permission to create symbolic links in Group Policy
polseditx64.exe
(64 bit version)SE_CREATE_SYMBOLIC_LINK_NAME
):The installation of Laragon should be intuitive and largely self-explanatory via the guided installation process. The latest release of the WAMP stack can be downloaded directly from GitHub in the appropriate version.
ToDo: Download and install Laragon
laragon-wamp.exe
(64-bit version)laragon-wamp.exe
. Under certain circumstances, a message from the Windows Defender
SmartScreen may appear at this point, indicating that the start of an unknown app has been prevented. However,
the link “More Information” allows you to “Run anyway”.In the future, Laragon can be accessed via the corresponding new entry in the Windows Start menu or via the Laragon shortcut icon on the Windows desktop. After starting the application, a program icon appears in the Windows notification area (System Tray) that also displays the status of the services (started or stopped) and can be used to open the Laragon management panel:
Laragon can be adapted and configured relatively easily. For example, the “Create new website” feature can be used to completely automate the installation of a new Contao instance so that a fresh Contao installation can be set up with just a few clicks.
ToDo: Define settings in Laragon and configure apps
{name}.local
The Laragon configuration settings are stored in the file laragon\usr\laragon.ini
and can of course be changed
there as well.
[php]
add the PHP sys_temp_dir
variable to the values of the key QuickSettings
:QuickSettings=xdebug, max_execution_time, upload_max_filesize, post_max_size, memory_limit, sys_temp_dir
-1
(or 2G
, 4G
):C:\laragon\tmp
(adjust the Laragon root directory if necessary, if Laragon is not installed
on the drive C:\
under the default path):In the same submenu, the Laragon environment variables can be removed if necessary. You can also use the menu item “Manage Path” to check if the path information has been added correctly to the PATH environment variable.
The app configurations are saved to the file laragon\usr\sites.conf
.
laragon\usr\sites.conf
the contao-specific adjustments can now be added:# Options
AutoCreateDatabase=true
Cached=true
# Blank: an empty project
Blank=
------------------------------------------------------
# Contao 3.5
Contao 3.5 Website …=composer create-project contao/core %s 3.5.*
# Contao 4.4 LTS
Contao 4.4 Website …=composer create-project contao/managed-edition %s 4.4.* && curl https://download.contao.org/contao-manager/stable/contao-manager.phar -o %s/web/contao-manager.phar.php
# Contao 4.9 LTS
Contao 4.9 Website …=composer create-project contao/managed-edition %s 4.9.* && curl https://download.contao.org/contao-manager/stable/contao-manager.phar -o %s/web/contao-manager.phar.php
------------------------------------------------------
# Wordpress
Wordpress=https://wordpress.org/latest.tar.gz
# Joomla
### Joomla=https://github.com/joomla/joomla-cms/releases/download/3.8.11/Joomla_3.8.11-Stable-Full_Package.tar.gz
# Prestashop
### Prestashop=https://github.com/PrestaShop/PrestaShop/releases/download/1.7.4.2/prestashop_1.7.4.2.zip
------------------------------------------------------
# Drupal
Drupal 8=https://ftp.drupal.org/files/projects/drupal-8.5.5.tar.gz
### Drupal 7=https://ftp.drupal.org/files/projects/drupal-7.59.tar.gz
------------------------------------------------------
# Laravel
Laravel=composer create-project laravel/laravel %s --prefer-dist
Laravel (zip)=https://github.com/leokhoa/quick-create-laravel/releases/download/5.6.21/laravel-5.6.21.7z
### Laravel dev-develop=composer create-project laravel/laravel %s dev-develop
### Laravel 4=composer create-project laravel/laravel %s 4.2 --prefer-dist
### Lumen=composer create-project laravel/lumen %s --prefer-dist
------------------------------------------------------
# CakePHP
### CakePHP=composer create-project --prefer-dist cakephp/app %s
# Symfony 4
Symfony=composer create-project symfony/website-skeleton %s
Of course, the app configurations of the other web applications can also be removed or commented out, as long as they are no longer needed.
Using the parameter AutoCreateDatabase
in the section Options
you can configure whether databases should also
be created automatically or not. By default, every newly created web project will also create a new, empty database
with the same name at the same time.
The changes in the laragon\usr\sites.conf
are immediately active after saving; Laragon does not need to be restarted.
Although Laragon already comes with Composer, it may be necessary to install the PHP dependency manager globally on the system.
ToDo: Install Composer globally
Composer-Setup.exe
and follow the guided installation process in the setup wizard:php.exe
should be able to determine the path to automatically, provided the Laragon Paths
have been added to the Windows PATH environment variable as specified above.laragon\www
navigate to the Laragon directory in Windows Explorer,
right-click on it to start the “Console” and, for example php -v
, execute and composer -V
run it:As mentioned before, the Laragon feature “Create a new website” allows you to create a new website based on any version of Contao relatively quickly and with just a few clicks. Laragon will automatically create the empty database and configure the virtual host.
ToDo: Set up a new Contao installation
mycompany
in the input field (if possible, the project name should
not contain any special characters, because it is also used as database name) and confirm with “OK”:web/
as contao-manager.phar.php
.mycompany.local
127.0.0.1 mycompany.local #laragon magic!
in addition:
http://mycompany.local/contao/install
.Contao front end: http://mycompany.local/
Contao back end: http://mycompany.local/contao (or http://mycompany.local/contao/login)
Contao installation tool: http://mycompany.local/contao/install
Contao Manager: http://mycompany.local/contao-manager.phar.php
(The system check of the Contao Manager should automatically detect the path to the PHP binary if a manual configuration is selected in
the server configuration via “Other …”)
If the browser software performs a web search for this keyword when entering, for example, contrary mycompany.local
to expectations, the schema or network protocol http://
should also be specified when calling, i.e. http://mycompany.local/
.
Appendix with further information/tasks:
ToDo: Install the latest version of Laragon
laragon.exe
one in the Laragon installation directory with the previously downloaded executable.ToDo: Remove an existing website project
ToDo: Install Contao Official Demo
composer require contao/official-demo
Depending on the Contao version, it might be necessary to request the appropriate version of the Contao Official Demo (COD). For Contao 4.9, this would be the case:
composer require contao/official-demo:4.4.0
Like any other package/bundle, the Contao Official Demo (COD) can be installed in the same way via Contao Manager.
ToDo: Install phpMyAdmin
phpMyAdmin-x.x.x-all-languages
in phpMyAdmin (Attention: Please note
that the folder name is case sensitive!)phpMyAdmin
including all files and subfolders to laragon\etc\apps\
. In the
folder laragon\etc\apps\phpMyAdmin\
duplicate the example template of the phpMyAdmin configuration
file config.sample.inc.php
and rename the copy to config.inc.php
.
Edit the configuration file config.inc.php
and adjust the settings as follows/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['port'] = 3306;
$cfg['LoginCookieValidity'] = 36000;
http://localhost/phpmyadmin
call phpMyAdmin viaroot
The Apache alias configuration for phpMyAdmin is located in laragon\etc\apache2\alias\phpmyadmin.conf
.
Sometimes you need PHP 5.6 for older web projects, but you want to test new features with PHP 7.3. In the following, both PHP 5.6 and PHP 7.3 will be made available in Laragon.
ToDo: Add more PHP versions and switch between the different PHP versions
php-5.6.40-Win32-VC11-x64.zip
and php-7.3.2-Win32-VC15-x64.zip
):
https://windows.php.net/downloads/releases/laragon\bin\php
into the corresponding
folders (php-5.6.40-Win32-VC11-x64
or php-7.3.2-Win32-VC15-x64
).php-5.6.40-Win32-
VC11-x64
–> Apache: VC11 httpd-2.4.38-win64-
php-7.3.2-Win32-
VC15-x64
–> Apache: VC15 httpd-2.4.35-win64-
httpd-2.4.38-win64-VC11.zip
): https://www.apachelounge.com/download/VC11/laragon\bin\apache
into the corresponding folder (httpd-2.4.38-win64-VC11
). The unpacked files and folders may have to be moved to match the given folder structure (see httpd-2.4.35-win64-VC15
).There is a thread in the Contao forum that deals with the installation and operation of Laragon or you can get advice in the Laragon forum DE or EN