Skip to main content
March 28, 2012
Question

Moving WampServer from C to D drive?

  • March 28, 2012
  • 3 replies
  • 37460 views

I'm hoping to find someone in the DW forum who understands how to move a wamp test server to a different drive.  So far, haven't gotten much traction at the WAMP forum.

I'm assuming just moving the files/folder won't work.

Is it a matter of doing a wamp install on the "D" and finding a way to move the data which, after the install, I assume will just be windows file/folder moves.

And then I assume the method used in DW is to update the test server path on the sites that use the local server.

Is this close?

Thanks

Tom

This topic has been closed for replies.

3 replies

Participant
February 25, 2015

I wanted to move my current installation from D:/wamp to C:/wamp

The real problem would be with mysql databases.

They can be exported and imported into the new installation.

This was not convenient to me as I had many databases with GB's of data.

Though using mysql dump was an option, all that seemed a bit risky to me.

Earlier, in similar situations, I used to create a new installation of wampserver having

the same versions of php, mysql and apache and then replace  bin/mysql/data with the

folder form the old one and manually check for changes to be made in


:\wamp\bin\apache\Apache2.2.21\conf\httpd.conf


\wamp\bin\apache\Apache2.2.21\conf\extra\httpd-vhosts.conf

because i have many websites being served by apache


Stopped wampmysqld, wampapache services

exit wamp server

Copied the wamp folder from D: to C: .... had the one in D: intact, just in case.

I used Notepad++ ... made a file search for D:/wamp in "C:\wamp" using file types *.php; *.ini; *.conf; *.txt";

Using the first three ... result was out in a second or so.

After adding .txt, it took a few seconds more, may be a minute.

My system has a i5-3210M Processor and 16 GB Ram.

[Since your system capability affects the time taken for search]

I used find first

and then after assuring myself that what i got was what i was looking for,

I used find and replace

Replaced all D:\wamp with C:\wamp.

Changed the drive letters in the "Target" and "Start In" fields of the Shortcut tab of the start Wamp Server Properties dialog box relating to the shortcut here

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\WampServer\start WampServer

Since i have setup apache and mysql as services I had to change the drive letters relating to the services also

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\wampapache

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\wampmysqld

ImagePath    holds the value relating to the path

change the drive letter from d: to c:


started wamp server from the startup folder, and checked.

Done;

Changed the

These are the files affected

@

\wamp\wampmanager.ini (719 hits)

\wamp\bin\apache\Apache2.2.21\bin\php.ini (6 hits)

\wamp\bin\mysql\mysql5.5.16\my.ini (3 hits)

\wamp\bin\php\php5.3.8\php.ini (6 hits)

\wamp\bin\php\php5.3.8\phpForApache.ini (6 hits)

\wamp\alias\phpmyadmin.conf (2 hits)

\wamp\alias\sqlbuddy.conf (2 hits)

\wamp\alias\webgrind.conf (2 hits)

I am including these to give an idea of affected areas.

Anyone trying this route should be conscious that their finding need not be exactly the same.

I came here while searching for a solution at the beginning.

Putting this here assuming that some one else might find it helpful.

Community Expert
March 28, 2012

Are you looking to move the www or the server?  If you want to move the server on Windows, just re-install like Drymetal says.  If you want to move the www folder open up httpd.conf and change the DocumentRoot to the new path and move the testing server files over there and tell DW the new path.

Participating Frequently
January 27, 2013

Dear SnakEyez02,

How exactly -- at the risk of appearning lower than the lowliest noob! -- do I "open up httpd.conf" (emphasis mine) and respecify the path of the Apache Document Root? I tried to do this with Commmand Prompt but it said that the path specified did not exist (the path was NOT misspecified... I don't think... I wrote, at the ">" cursor: "edit C:\Program Files\EasyPHP-12.1\conf_files\httpd.conf" (less the quotes, of course).

I got to thinking (dangerous! ) that Command Prompt may not like white space, and since I have noticed that it sometimes renders white space as a "%", I tried again with the "Program%Files" change, otherwise all else the same. Nada! (Hmm, should I also have changed "edit C:\" to "edit%C:\"???)

So, how does one go about editing the httpd.conf file???

Thx,

AdobeFlat

(Edited a few minutes later... )

If I might add to this so as to point to a concrete excerpt from the httpd.conf file, I have noticed that there are several places where the term "DocumentRoot" (no white space!) is mentioned, followed by the path, except that it is just generically (or shorthandedly/ symbolically) referred to as "{path}/www". So I'm guessing that the idea is to make the change in the first location of "DocumentRoot", then thereafter all of the "{path}/www" bits in all the other instances of "DocumentRoot" will refer to this change/ point back to the first-instance path?

Here is an excerpt from the httpd.conf file showing the very first instance of "DocumentRoot", so anyone who responds to this should probably use this excerpt in order to make suggestions, unless there is a different, Best Practices way to go about this:

*--- (beginning)

# Deny access to the entirety of your server's filesystem. You must

# explicitly permit access to web content directories in other

# <Directory> blocks below.

#

<Directory />

    AllowOverride none

    Require all denied

</Directory>

#

# Note that from this point forward you must specifically allow

# particular features to be enabled - so if something's not working as

# you might expect, make sure that you have specifically enabled it

# below.

#

#

# DocumentRoot: The directory out of which you will serve your

# documents. By default, all requests are taken from this directory, but

# symbolic links and aliases may be used to point to other locations.

#

DocumentRoot "${path}/www"

# This should be changed to whatever you set DocumentRoot to.

# ======================================================

# !!! DO NOT CHANGE THIS LINE AND THE FOLLOWING ONES !!!

# DocumentRootDirectory

<Directory "${path}/www">

---* (ending)

Hey, would it have made a difference in Command Prompt in specifying the path if I had used regular (forward) slashes instead of backslashes?

Thx,

AdobeFlat

Message was edited by: AdobeFlat

(A second short editing/ add-on, hours later... )

The httpd.conf file cannot be edited directly, says someone, else it will create havoc. I now believe this, having finally edited it directly! In the end, I had to simply re-install EasyPHP and all of the support components (the modules were still there), after having done a System Restore that did not work, alas.

Now I am back to square one: I need to know how to alter the httpd.conf file so that I can place my website files (and create a virtual host in) a DocumentRoot whose location is of my own choosing, such as on my data drive, rather than being located on the vulnerable (to virus attack) system drive. One would think that SourceForge would offer an Introduction that explains such an important feature in language that non-geeks can comprehend!

AdobeFlat

(A much later and much happier edit: I found a solution that works!)

It is too late and I am too tired to go through this right now, but I promise to do so tomorrow, when I will give precise instructions for EXACTLY which steps to take in order to ALTER (MOVE!) the DocumentRoot path specification (in the httpd.conf file) from its default path (inside Program Files on the system drive) to, say, a data drive path. The instructions will be for EasyPHP.

If you don't have a fancy editor, Notepad will do just fine (EasyPHP calls up Notepad per default whenever it notifies one of something out of kilter with the httpd.conf file that needs correcting).

I'll also show you how to make EasyPHP spit out an Installation Information page that will confirm that the ALTERED DocumentRoot path specification has indeed been ACCEPTED!

All will be revealed -- tomorrow! (If they had a "Relieved" smiley above, here is where I would put it!)

AdobeFlat

Message was edited by: AdobeFlat

Participating Frequently
January 28, 2013

{I note that Tom has added a new entry. However, the following is meant to be general help to anyone who crosses these pages by chance in search of how to change the path of the DocumentRoot. There are zillions of forums where the question is posed but not answered, or is not adequately answered... while the coding itself is simple, the supplementary commentary requires a lot of words is ambiguities are to be avoided, or if a "hands-on" approach is desired by the seeker.}

How to Re-specify the Path of DocumentRoot in EasyPHP

To make this change, you must open the httpd.conf file in an editor such as Editra (free) or phpDesigner8 (free to try for 21 days, but it is good enough (and cheap enough) to buy, so I wouldn't download it and waste the trial period just for this task!) – or good ol' Notepad, which is already on your system if your OS is Windows (this, for noobs!).

Here's WHERE your httpd.conf file is located, depending on the name of your actual virtual server (mine is EasyPHP-12.1) and depending on the letter of the system drive where you have installed said server:

C:\Program Files\EasyPHP-12.1\conf_files

In the httpd.conf file, you will see several references to DocumentRoot of this type:

"${path}/blah-blah-blah"

That is NOT what you are looking for (the above is a symbolic reference to the actual path, which we will find – and change! – presently). Instead, the full path of the DocumentRoot (hereafter: DR) is located near the bottom, or end, of the httpd.conf file in something called "Directory", written with paired tags, like so: "<Directory>", "</Directory>" (in my file, it is located just above the "<VirtualHost>, </VirtualHost>" entry, but this may simply be because I added the VirtualHost module to my EasyPHP folder).

NB! If you have not provided a password to your MySQL database, it is vulnerable to outside attack, therefore I will end these instructions below with an appended section on how to set up the password. (Note that the actual coding here, as always, is as compact as a grain of sand, it's just that in order to dispel any and all ambiguities, one has to employ an ocean of descriptive-supportive words!) I mention this because you probably shouldn't be surprised if, once you have added a password, Apache will automatically change the access parameters reflecting the limited access implicit in the setting up of a password – in fact, the httpd.conf file is not etched in stone, it reflects the status of the Apache system at any given point in time. Oh, I almost forgot, I'll also tell you how to have EasyPHP spit out an Installation Information page that will confirm that the ALTERED DocumentRoot path specification has indeed been ACCEPTED!

Here is what my "Directory" entry looks like now:

# <Directory "C:/Program Files/EasyPHP-12.1/www">

<Directory "D:/EZPHP-Desktop/www/Tim-Berners-Lee">

Options FollowSymLinks Indexes

AllowOverride All

Order deny,allow

Allow from 127.0.0.1

Deny from all

Require all granted

</Directory>

All that got changed is that the default DR address, or path, "C:/Program Files/EasyPHP-12.1/www", was altered. By me, in phpDesigner8. Following instructions that I found elsewhere, I, at the same time, attempted (unsuccessfully, more on this in a jiffy) to change the contents between the "Directory" tags as follows:

Options Indexes FollowSymLinks

AllowOverride All

Order allow,deny

Allow from all

and though I saved the file, and though Apache did indeed accept my DR path change (note that I didn't delete the original path, I – for safety's sake until I get it all running smoothly – chose to just "comment it out", i.e., I prepended hashtags), Apache did NOT accept my changes in the safety parameters, presumably because I had already set a MySQL password.

If the "VirtualHost" tags (below the "Directory" tags near the bottom of the file, or the place we are describing) are present, then you need to change their "contents" as well, so that the contents will look similar to this (substituting the DR path of your choice, of course, and with A MAJOR CAVEAT mentioned below):

<VirtualHost 127.0.0.1>

DocumentRoot "D:/EZPHP-Desktop/www/Tim-Berners-Lee"

ServerName localhost

# DocumentRoot "C:/Program Files/EasyPHP-12.1/www"

# ServerName localhost

</VirtualHost>

Note that also here I chose to "comment out" the original DR path, and don't fret if your VirtualHost says "localhost" instead of 127.0.0.1.

THE MAJOR CAVEAT:

My Apache setup surely violates at least some protocols here (EasyPHP > Administration generates a lot of pesky but non-fatal errors in the VirtualHost module that I installed as an add-on, but which I have not yet configured... it was important to first get the change in the DR path ironed out). Namely, w.r.t. the naming of the DR and the Alias, which, I'm pretty sure, aren't supposed to be one and the same (the Alias, if on the path of the DR (you can put Aliases anywhere), should be a subdirectory, or subfolder, under the DR folder; certainly not, as I have done here, the exact same folder!).

Note that Apache is looking for the DR to end in "www" or a variant thereof, such as "wwwtim-berners-lee"; I have named the DR in my setup precisely as one would name an Alias, which, if placed in the DR, would belong to a subfolder there, like so: (DR name/path)/Alias.

As soon as I rename my DR to "www something-or-other" (all in one word) and make my "project folder" – my website project, or my Tim-Berners-Lee (all in one word not necessary here) folder – the Alias, then I am confident that the pesky messages in VirtualHost will cease & desist. At that point, when I am sure that I have gotten all the snags ironed out, I will clean up my httpd.conf file, deleting the superfluous, "commented out" DR paths entirely.

How to Set a Password in MySQL DBMS:

("DBMS" stands for "database management system", and note that I found the template for this somewhere online and naturally altered it to suit my computer environment):

To set a password of, say, "Comanche", assuming that you have EasyPHP or something similar installed on your computer, choose the Run option in the Start Menu and enter:

"C:\Program Files\EasyPHP-12.1\mysql\bin\mysqladmin.exe" -uroot password Comanche

{EXACTLY as written above, though note that you will need to name the actual virtual server program you are using if you are not using EasyPHP-12.1, and the actual password will be one invented by you unless you like the name "Comanche" and are very foolhardy!}

Click OK and a window will rapidly open and close, and, if you have typed the command correctly, you will hear... NARY A SOUND (not the slightest beep)! Record your password in your Little Black Book!

Each time you start your virtual server program, you can make use of the MySQL command line interpreter by logging onto the MySQL DBMS, using your password, in the following way (which is altered slightly from the path listed above, so pay attention!):

Click on Run in the Start Menu, then paste the following (copied) path (eventually making a substitution for "EasyPHP-12.1" to reflect your actual virtual server, and substituting your own password, of course):

"C:\Program Files\EasyPHP-12.1\mysql\bin\mysql.exe" -uroot -p[your_password (whatever it is), eg., "Comanche" (like so: -pComanche), though without the quotes around "Comanche", and of course the password itself must NOT have gaps/ white space!]

Click OK, and a Command Prompt window belonging to the MySQL database will appear. When you are finished using the MySQL command line interpreter, you can exit the Command Prompt by typing "quit" (less the quotes, of course) at the cursor to the right of "mysql>".

Don't be a DUMMY; write your password down in your Little Black Book (do you realize just how many nincompoops – as we speak, as it were – are trying to find out how to reset their respective MySQL DBMS passwords because they forgot them?!)!!!

How to Access Your PHP Installation Information:

To test your Apache and PHP, create the file phpinfo.php in the directory D:\EZPHP-Desktop\www\Tim-Berners-Lee (YES, backslashes here!) and type in the following PHP contents {I simply created an HTML template in phpDesigner8, added the php string listed below in the "body" section, then saved it with a name ("My EasyPHP Installation Info") as a *.php file IN THE "Tim-Berners-Lee" folder mapped out above.}:

<?php phpinfo( ); ?>

To access this file, follow the usual procedure, making your very own personal substitutions where relevant:

1) Right-click the EasyPHP icon in SysTray and choose "Administration", then

2) Once inside "Administration", click on "Tim-Berners-Lee" under "Local Files" and a new tab will open, showing all of the contents of the "Tim-Berners-Lee" folder, then

3) Click on the name of the file in question ("My EasyPHP Installation Info") and a complete installation information sheet will open in a new tab, including the address/ path or your altered (moved) DR.

Voilà! (If the DR path didn't get changed, then you have erred somewhere, so you should recheck everything, and if that fails, have a second set of eyes run through it... it is amazing how the brian corects our erors wthout us evn regestring thm! : -) )

Drymetal
Inspiring
March 28, 2012

I moved Xampp once to another drive.   The process should be identical.   Here is what I did:

1. I backed up the htdocs folder where all my sites were.  READ: put a copy of this folder in a safe place.

2. I uninstalled Xampp completely.

3. I reinstalled it to the drive I wanted it installed on.

4. I copied the contents from my htdocs folder to the new one.

5. In DW, I updated the path for the websites as you mention above.

It worked and there weren't any issues.  Hope that helps.