Get TOP Windows and MAC Softwares up to 35% off (NEW!)

* indicates required


Symfony 3 installation on Windows 10 with Xampp - Symfony Tutorial

Setting up Symfony 3 can be a little headache on windows, and this is the reason why we decided to create this tutorial so you can always come back to the page and follow everything each time you set this up on a new machine.

Make sure to bookmark this page as you will use it a lot during your Symfony learning period.

Let's go straight to the point.

1 - Download Xampp

https://www.apachefriends.org/index.html

You can choose the latest version for your windows 10 operating system.
Install it.

xampp installation


2 - Edit Windows Variables

Edit your windows variables, this tells windows where your PHP and MYSQL paths are located.
In the windows search, type "control", click on the "control panel" icon and click on "Edit the system environment variables". By setting this up, you will be able to run commands anywhere in your cmd control panel.


windows 10 command

environment variables


Go to the bottom of the popup and click on "Environment variables".


variables windows


Setup environment variables in windows 10

Follow the images on this page and add these 2 lines to the paths:
Click on "New" and add them.

Add paths

C:\xampp\php
C:\xampp\mysql\bin


3 - Setup Your Vhosts

A virtual host is a kind of routing that tells your computer that a specific domain is linked to a precise folder locally.
It also tells the computer the port being used and the name of the domain.

Let's start....

Download notepad++

https://notepad-plus-plus.org/download/v7.4.2.html

The reason you need notepad++ is because you may need admin rights to certain files and notepad++ makes it super easy to sort this out for us.

Type this in your windows 10 search bar:

C:\xampp\apache\conf\extra\httpd-vhosts.conf

Open it with notepad++

httpd config

On my windows machine, unfortunately, the port 80 is causing xampp not to start, so in my case, I will be using the port 8080. I believe this is due to skype being installed on my computer.
If you can start xampp and apache turns "green" then your port 80 is fine, otherwise, setup in xampp the port 8080 like this:

Setting up port 8080

Also also, by clicking on the "config" button next ot the apache service, you will have access to the apache httpd.conf file, open it and change this line:

Listen 80

to

Listen 8080



Coming back to the httpd-vhosts.conf

Make sure you have these 2 settings added:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/myfirstapp/web/"
ServerName myfirstapp.com
ServerAlias www.myfirstapp.com
</VirtualHost>


The document root will be the path of your future symfony app.
Change "myfirstapp" to anything you like but make sure that when you will create your symfony app, this name matches the installation folder.


4 - Setting you your local hosts file.

This will tell windows that when you type "myfirstapp.com" it should not go on the web to look for the domain name but instead look on the local server(xampp in your case).
Type this in your windows search bar:

c:\Windows\System32\drivers\etc\hosts

Open it with Notepad++, you may receive a warning saying that you need to have admin rights to save the file, if this is the case click on "This file is protected use the administrator mode..."  and the file will reopen with admin rights.

Add this to the file:

127.0.0.1       localhost
127.0.0.1       myfirstapp.com 
127.0.0.1       www.myfirstapp.com 

5 - Download a certificate for the installation of symfony

Symfony download is secured and you will need a certificate for the download

Go here:

https://curl.haxx.se/ca/cacert.pem

Place this .pem file here(create the ssl folder):

c://xampp/ssl

Go to your php.ini file and add this line to it:

curl.cainfo = "C:/xampp/ssl/cacert.pem"

If you do not know how to access your php.ini file, simply check this image:

php ini file


6 - Download symfony.phar and add it here:

xampp/htdocs

via this url:

https://symfony.com/installer

Remember, do not place symfony.phar in your project file but outside(in the htdocs directory).

7 - Open a command prompt(cmd) and type this:

Go to this directory

c:\xampp\htdocs\

And now type:

php symfony.phar new myfirstapp

This command will create a new folder called "myfirstapp" with all the require symfony files. On some machines, the download of symfony will take time, be patient as there are a lot of dependencies

7 - Install composer:

https://getcomposer.org/Composer-Setup.exe

After the installation, open a command prompt and type:
composer update

8 - Restart apache from xampp and you may also need to restart your pc for everything to work properly.

9 - When the pc reboots, starts xampp and apache, make sure it is "green".

Go to your browser and type:

myfirstapp.com:8080/app_dev.php   (if you are using the port 8080)

or

myfirstapp.com/app_dev.php

if this does not work, type:

myfirstapp:80/app_dev.php

You should now see a page like this one:

Smyfony 3 installation


If you loved this life-saving tutorial, please leave us a comment below, it takes time to create this type of step by step and comments are some kind of rewards for us.

We love helping others to achieve their goals!