Enable VHOSTS in Bitnami's WAMP Stack Without Breaking phpMyAdmin
If you're like me, you only want to set your configuration up once, instead of installing a bunch of separate instances which just gets way too out of control all to quickly. Getting this to work with Bitnami's WAMP stack is simple, however it broke the phpMyAdmin application it installed along with the manager panel. After briefly investigating why that could have happened I found a solution to get phpMyAdmin running again without it feeling like a hack. So, with that in mind, here are the steps for installing WAMP with vhosts enabled without breaking the phpMyAdmin interface.
Step 1: Install Bitnami's WAMP Stack
This guide will focus specifically on how to get WAMP working on Windows 10, using the PHP 7.4 distribution. PHP 8.0 is the current version as of writing this, but that will be addressed in a future post (when Bitnami provides a distribution for it).
To get the installer, visit https://bitnami.com/stack/wamp/installer and download the PHP 7.4 version from the link at the bottom of the page. Go ahead and install it on your machine.
For the sake of this guide, I will be installing it to
Step 2: Enable VHOSTS in Apache
If you're not familiar with VHOSTS in Apache, you're in for some awesome times. This wonderful feature allows you to share a single environment with multiple projects (assuming you want to standardize that way to begin with). To enable VHOSTS, browse to your installation directory, and edit the
Once you have it open in your preferred editor, find this line:
Uncomment it (remove the "#" sign at the front), so that it reads:
Go ahead and save the changes to the file. Keep it open for step 3.
Step 3: Load phpMyAdmin Prefix Configuration
When you installed WAMP it created an instance of phpMyAdmin outside the apache2 directory, and created a couple of Apache configuration files that help direct the WAMP manager on how to load and run it when the server is started. Enabling VHOSTS will break this functionality because we're changing what the environment is looking for from being just one thing, to many things.
Find the line that loads the default configurations:
After this line, you'll want to include the following two lines:
# Re-link PHPMyAdmin after Enabling VHOSTS
Now you can save and close this file. We're done with making configuration alterations for Apache.
Step 4: Create a Project Directory
First, lets create a new directory in
apache2/htdocs/ let's name it
Now that we have
apache2/htdocs/test-project created, lets put an
index.php file into it, with something you expect to see once we get this whole thing working. Save and close the file.
Step 5: Map a Local Domain to a Directory
Apache needs to be told what to serve when you access it from any domain. This is what the VHOST file is for. It will associate a directory on your machine with a domain so when you type that domain into your browser, you get the right group of files.
With our project directory and default file created, we can now tell apache to serve that project when we request a specific domain. Find the
apache2/conf/extra/httpd-vhosts.conf file and open it up. You'll see two groups of instructions wrapped by a
<VirtualHost *:80> enclosure. Delete these two default entries.
Add the following block to your file:
ServerAdmin [email protected]
CustomLog "logs/test-project.access.log" common
You can probably make out what's going on here, but if not, or maybe you want to know more, check out the official documentation over at Apache for a particularly dry read.
Save and close the file.
Step 6: Create a Local DNS Entry
This step essentially tricks your machine into believing its accessing the internet when it really is not. It's important to not use a real domain that you plan to access regularly as this will always be active whether your WAMP server is running or not and you'll be the only person who can see it.
You might already see a couple entries in the file, but you'll want to add the following line to tie this whole thing together:
# My WAMP Test Project
It's recommended that you put comments with each entry so that if and/or when this file grows, you can keep track of what is what.
Save and close the file.
Step 7: Let's Get To It!
If WAMP is already running go ahead and either close out of it completely, or stop all the services from running. Once you see the service indicators turn red, start the services up again (or start WAMP if it wasn't opened). You should be able to access your project by entering
test-project.local into your browser, and just as important, you can click the phpMyAdmin button in the WAMP Manager and still have it work.