Getting Started /en Yii2 Coding /en

Prepare your system

Before you can start using the framework with it’s full features, you need to setup the basement to run it on. The easiest way to do so, is to use the xampp-installer from the apachefriends which can be found on their website:

Their you will find a complete set of tutorials and instructions on how to setup the enviroment. As Yii2 requieres a PHP version above 5.4.x you should take care that you are using one of the latest packages for your system. As all my examples are based upon using a relational database management engine – MYSQL – pls. install the “Service/Server” too!

After you have done this, you should be able to reach the following to “local” adresses within your webbrowser of choice – I use firefox or chrome…

  1. http://localhost (should show the xampp default page with the information about a successfull installation)
  2. http://localhost/phpmyadmin (should show the mysql webbased databasemanagement tool)

To ease up our live and to have a more simple directory structure, we’ll change the “webroot” (the place where localhost points to) as we don’t wanna use the “for me” complex default location.

The default “webroot” on windows is set to:

"C:\program files\xampp\htdocs"

and I normally work within the root directory of my main data disk:


To achieve this “webroot” you need to edit some parameters within a config file that could be opened through the xampp management console:

xampp-control-panelAfter you “clicked” on the “Admin…” Button you should end up in a .conf (text) file. To be honest, the first time I saw this, I was so afraid of “mistakes” but after a view tweeks, you’ll find out that programming is a very simple thing… The machine does what it was ordered to and if something goes wrong, it’s because you made a mistake…;)

So, back to the important thing! After you’ve opened the config file with the editor of your choice… Pls. find the part within, where the config (“c:\XAMPP\apache\conf\httpd.conf”) looks like this:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot D:/www/htdocs/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    <Directory D:/www/htdocs/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all

As windows is case sensitive, pls. take care of this as and potential error source!

To check if your adaption has worked out, create a “index.html” file with the following content under “D:/www/htdocs/”:

 Hello World!

So know after entering your “http://localhost” you should be welcomed with <<Hello World!>>.

Leave a Reply