WAMPServer 3 Create a Virtual Host, the easy way
Posted by: RiggsFolly (Moderator)
Date: May 14, 2017 04:04PM

Wampserver 3 - Create or add a VirtualHost

With Wampserver 3, you can create a VirtualHost with few clicks.
For ease of explanation, here are some names:
- sitefolder : folder in which you want to host the local site
- sitename : name that will be called the local site (http://sitename/)

First, choose where we want to host your local site, it can be a folder in Wampserver as wamp/www/sitefolder/ but this is not mandatory; this host folder can be anywhere on the hard drive, avoiding the paths comportants spaces; for simplicity of explanation we choose c:\sitefolder\.
We need the folder to host the site exists before creating the VirtualHost, we must create it whith File Explorer, launched as administrator(See bottom of page *) :
- Move in the disk tree to where we want to create the folder "sitefolder"
- Right-Click, New -> Folder
- Then type the folder name

- Lauch Wampserver, wait for icon W green
- Wampmanager Icon -> localhost
We arrive on the home page Wampserver, without Your VirtualHosts menu in the lower right (This is normal, just after installing Wampserver)
- Click Add Virtual Host in your Tools menu at the bottom left
We arrive on the Add Virtualhost page in which it is required to validate the VirtualHost submenu, then:
- Right-Click Wampserver Icon -> Wamp Parameters -> VirtualHosts submenu

We reload the Add VirtualHost page via the options of the browser or by clicking on the link at the top Add a VirtualHost
There, a green border box message indicates things to do, no problem, it'll be all alone if you click on the large button down, noted:
- Click on "Start the automatic correction of errors inside the green borders panel"
Arriving there, everything is ready in order to create his first VirtualHost
- In the form
-- For « Name of the Virtual Host No diacritical characters (éçëñ) - No space - No underscore(_) », we type:
-- For « Complete absolute path of the VirtualHost folder Examples: C:/wamp/www/projet/ or E:/www/site1/ », we type:
-- If you want to use PHP in FCGI mode
Check to use a PHP version other than the default.
Choose the PHP version you want from the drop-down menu
And validates the form by the button:
- Start the creation of the VirtualHost
As stated: It can take some time.

After this "time" it is stated that unfortunately certain operations required for the recognition by Windows and and Apache of this new VirtualHost can not be performed automatically by the browser, so, as shown:
- Right-Click Wampmanager Icon -> Tools -> Restart DNS
Wait until the icon turns green.
Click on Back to home
You now have Your VirtualHost Your menu, at right with such items:
- localhost
- sitename
Likewise, you also have this submenu Your VirtualHosts with Wampmanager icon.

Now everything is ready to set up your local site in the folder c:\sitefolder\ indicating, if required during the installation, that the URL is (http://sitename/) (Without parentheses).

Nota 1 : This procedure was written in real time from a blank installation Wampserver.
Nota 2 : This is a hundred times longer to write than done!

*To launch an application, via its shortcut, as administrator :
- Right-click on the shortcut, Properties
- Shortcut tab
- Advanced button
- Select Run as Administrator
- OK, Apply, OK

(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Edited 2 time(s). Last edit at 08/24/2023 08:31AM by Otomatic.

Options: ReplyQuote
How to Install Composer in WAMPServer
Posted by: Otomatic (Moderator)
Date: January 08, 2021 03:03PM

Original post from RiggsFolly

How to Install Composer in WAMPServer

Composer of course is a command line tool, that uses PHP, so the first thing to do is make sure you can get to a php.exe from anywhere when running from a Terminal/Command Prompt.

WAMPServer does not need OR more importantly like you to use the normal Windows method of achieving this which is to add to the PATH environment variable.
This is not a problem we can do this by creating a little bat/cmd file that will add a folder containing a php.exe to the PATH only for the duration of the existance of the Command Prompt you open to use composer. This way it will never even be noticed by WAMPServer as having been temporarily added to the PATH.

I use this batch file to do this, I call it `phppath.cmd` and I save it to any folder that is already on the Windows PATH, so I can run it from anywhere when using a command prompt window.
I have a `C:\bin` folder for this, that is already on my PATH, you could also just drop it into the C:\windows folder as that is always on the PATH.

File called phppath.cmd
@echo off
REM **********************************************************************
REM * PLACE This file in a folder that is already on your PATH
REM * Or just put it in your C:\Windows folder as that is on the
REM * Search path by default
REM * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REM * EDIT THE NEXT 3 Parameters to fit your installed WAMPServer
REM * - baseWamp : is the drive and folder where you installed WAMPServer
REM * - defaultPHPver : is the version of PHP that will be pathed
REM *                   if no Parameter is put on the bat file
REM * - composerInstalled : Where I installed Composer
REM * This next one probably does not need changing but is there just in case
REM * - phpFolder : The folder structure that contains the Multiple
REM *               possible version of PHP WAMPServer has installed
REM **********************************************************************

set baseWamp=C:\wamp64
set defaultPHPver=8.0.1
set composerInstalled=%baseWamp%\composer

set phpFolder=\bin\php\php

if %1.==. (
    set phpver=%baseWamp%%phpFolder%%defaultPHPver%
) else (
    set phpver=%baseWamp%%phpFolder%%1

php -v
echo ---------------------------------------------------------------


IF exist %phpver%\pear (
    set PHP_PEAR_SYSCONF_DIR=D:\wamp\bin\php\php%phpver%
    set PHP_PEAR_INSTALL_DIR=D:\wamp\bin\php\php%phpver%\pear
    set PHP_PEAR_DOC_DIR=D:\wamp\bin\php\php%phpver%\docs
    set PHP_PEAR_BIN_DIR=D:\wamp\bin\php\php%phpver%
    set PHP_PEAR_DATA_DIR=D:\wamp\bin\php\php%phpver%\data
    set PHP_PEAR_PHP_BIN=D:\wamp\bin\php\php%phpver%\php.exe
    set PHP_PEAR_TEST_DIR=D:\wamp\bin\php\php%phpver%\tests

    echo ---------------------------------------------------------------
) else (
    echo ---------------------------------------------------------------

REM **************************************************************
REM * Ensure you have set variable 'composerInstalled' above
REM * Done this way as W10 has issues with setting path with (86)
REM * in the path inside an IF with parentheses, would you believe
REM **************************************************************


set COMPOSER_HOME=%composerInstalled%
set COMPOSER_CACHE_DIR=%composerInstalled%
composer -V
echo TO UPDATE COMPOSER ITSELF do > composer self-update
echo ---------------------------------------------------------------

echo ---------------------------------------------------------------
echo ---------------------------------------------------------------


set baseWamp=
set defaultPHPver=
set composerInstalled=
set phpFolder=

Call this from the command prompt as either
to path the default php version
>phppath 7.4.22
to path a specific version of PHP

The rest of this tutorial assumes you have done the above and `phppath.cmd` is working

Now to Install Composer
I will install composer into `c:\wamp64\composer` it could be placed anywhere and in any folder as long as you then amend the above batch file parameter `composerInstalled` to match

1. Start a command prompt, and create a folder to contain composer
Use whichever PHP version you want from the ones you have installed within WAMPServer

- phppath 8.0.1
- CD \wamp64
- MKDIR composer
- CD composer

2. Go to https://getcomposer.org/download`,
- DO NOT USE Windows Installer
- find the section "Command-line installation"

There are 4 lines there, copy one line at a time from the web page and Paste into you command prompt window and press enter (to execute the copied line)

Composer is installed

To make it a little easier to run we now create a composer.bat file so we can run composer like it were a processor.
While still in the composer folder copy and paster this line to create a composer.bat file

echo @php "%~dp0composer.phar" %*>composer.bat

Now you can start a command prompt any time you like, run `phppath.php` and it will temporarily PATH everything for you.
You can then run composer by keying `composer` at the command prompt,
test that by
- starting a new command prompt

You should see something like
Composer version 2.0.8 2020-12-03 17:20:38

Finally If you get problems
You can just delete the composer folder and start again as nothing is placed in any kind of configuration for WAMPServer or Window

Edited 3 time(s). Last edit at 03/24/2021 05:15PM by RiggsFolly.

Options: ReplyQuote

Sorry, you can't reply to this topic. It has been closed.