13 COMMENTS... Share your thoughts

We all agree that PHP is the best thing to ever happen to web developers, and if you develop PHP applications on Windows, then Wamp Server makes setting up your local development server pure bliss! The problem however comes when you:

  • Have say a PC and a laptop and you want changes to the website you are working on to be updated in real time on both machines.
  • Want to show a demo to your client who doesn’t have a web hosting account yet
  • Want to collaborate on a project and you don’t want to spend your money on premium collaboration apps

Enter Dropbox to save the day. Dropbox provides an easy way to backup, store, sync, and, share files online.

dropbox-meets-wampserver

Let’s get down and dirty

For this, we will need a number of things:

  • Download Wamp Server (Latest version as of writing this is 2.0i)
  • Create a Dropbox account and download it (It’s FREE and you get 2 GB :) )
First

You will need to install Wamp Server. After you download the setup from their website, installation is pretty straightforward. I suggest you leave all the defaults and click next…next…next…finish. Once you are done, there should be a white semi-circle icon in your system tray. Hold on, we’ll get back to this later.

Second

Lets make sure Dropbox is up and running. Go to the Dropbox website and create a free account. You should get 2 GB of free online space, but if you use any of the links above you get 2.25GB, awesome! After that download the Dropbox client and install it on your PC and choose the location of your dropbox folder, by default it is in the My Documents folder. This process should be pretty straight forward.

Third

You will need to create a folder where you will store all the files you are working on. Go to the folder you chose as your Dropbox Folder location in Step Two above and create a folder, you can give it any name. For purposes of this tutorial, I will call it sites.

dropbox folder

Fourth

We need to tell Apache the new location of the root directory, in this case, the ’sites’ folder. This we do by editing Apache’s httpd.conf file. If you installed Wamp Server with its default settings, this file should be located at ‘C:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf’.

Open this file in your preferred code editor. The first line you want to edit begins in Document Root at around line 178. Change that to the path of the sites folder in your Dropbox. In my case its D:/My Dropbox/www/ Also note that, this file only accepts forward slashes, don’t use a back slash.

The next line you want to edit begins in at around line 205. Change that to the path of the sites folder in your Dropbox, same as above.

Fifth

Oooops, there is no step 5, that’s it. Now lets test this server. Create a new PHP file in the sites folder that shows some output e.g.

<?php
    phpinfo();
?>

Then go to your browser and open the url, http://localhost/testing.php. If you did everything right, you should information about your PHP configuration, something close to the image below.

php_info

For those of you who want to run this setup on several machines, just redo the steps on all your computers and you’re good to go.

That’s all for now folks

So for those of you who wanted a real-time backup of the websites your working on, or a fast and easy testing server, I hope this post has shed some light and helped you in some way. So, did you benefit from this post? Do you have any suggestions or ideas? Let me know what ways you can think of using dropbox. Lets share in the comments section

Don’t forget to subscribe to my RSS Feed or follow me on twitter

13 Responses to "Simple Testing Server using WampServer and Dropbox"

  1. comment by Morgan

    Hello Dude,

    One question, what about sql database? How could we sync databases for several computer?

    • comment by Brian Wangila

      Hey,
      Yes it is possible to also sync the databases. It is however a little complicated.

      In the folder C:\wamp\bin\mysql\mysql5.1.36\ there should be a data folder. Copy it into your Dropbox folder. Then go into your my.ini file and change the location of the datadir folder to the new location.

  2. comment by David

    I have all done und work, but the database no works, any idee..

    • comment by Brian Wangila

      This process does not affect the mysql database. All we are doing here is simply changing the location of Wamp Server’s www folder.

      Try redoing the process or tell me the exact error you’re getting.

      • comment by David

        thanks for the anwers,

        i work in my office and in my house, but only work in the office, in the house no work, if i some change for the design, example the ccs sheet, perfect, but if i add a new article, i can not see the article in the house…sorry for my english..

        • comment by Brian Wangila

          I understand what the problem is. The mysql database that stores your articles is not being backed up to dropbox hence it only works on one PC. My mistake, I did not include that in this tutorial. I will update this article to include that in a few.
          Thanks for pointing this out

  3. comment by pulstay

    Can we have the mysql database in Dropbox too? I tried changing my.ini to point to a directory in the dropbox folder. Unfortunately, the wampmysqld service fails to start. Any insight on this?

    • comment by Brian Wangila

      I have finally figured out a way to have the MySQL DB in Dropbox too without causing the service to fail. I will update the article to include this in a few

  4. comment by Silas Holsinger

    Would you mind if I reference a paragraph or two from your post? I’m writing a paper for college. Thanks very much!

  5. comment by sgacheru

    Interesting read as always. Gonna try it out. But I have a question. Is it necessary to go into the httpd.conf file and add the details? I usually install the wamp server and am up and running and it seems your process is the same since you are actually installing it locally and its been automatically backed up to dropbox.

    • comment by Brian Wangila

      The problem with installing wampserver in your dropbox folder is that you waste a lot of your dropbox space backing up all the installation files rather than just your project files.

      Also, If you have 2 PCs and you install wampserver on both in your dropbox folder, there will be a conflict, hence its better to install it in your root drive and move the www folder to your dropbox

Leave a Reply




Submit

Subscribe to Comments Feed by RSS