Web Development Environment made easy – Wamp Server + Dropbox (Sync PHP file and MySQL Database)

We used to write code for websites or web apps on daily basis but the code we develop need to be backed up or uploaded to some backup server. Which wastes a lot of time. We can save this time by using dropbox.
No doubt PHP is the best tool a web developer can have and if you develop applications on Windows you must have heard of Wamp Server. (Those who don’t know Wamp let me tell you it can setup your local environment in minutes to start developing your applications). There are many tasks we used to repeat daily or many times a day.
  • Pull from server – in case you are using GIT
  • Push to the Server – in case you are using GIT
  • backup database
  • backup files
  • Sync Files – in case you are using two development machines e.g. laptop, PC.
  • System got damaged then again developing from scratch because you forgot to backup. The worst one happened to me. 🙁
  • so on …

I also used to repeat these steps many times a day. Now my question was why to repeat same process every time, When they can be automated easily? So I came up with an Idea. I was already using Dropbox for backing up my documents and PHP files. (If you don’t know about Dropbox go to their website and take a tour; you are missing a money & time saver). But one day i came with an idea of syncing my databases using Dropbox. Here are the steps you can follow to keep your localhost synced, secure and controlled by dropbox’s strong version control system.

  1. Setup and install Wamp Server. To download one follow the link.
  2. Setup and install Dropbox. Follow the link to download. (If you will follow this link you and me both would get 250MB extra space. By default Dropbox provide 2GB of storage. You would get 2.25GB from this link.)

Main Configurations Start from here.
Now Apache needs to be informed to store and use Dropbox as root directory:

  • Create a folder named ‘www’ in dropbox folder and tell Apache to use this folder as root.
  • 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:wampbinapacheApache2.2.21confhttpd.conf’. (version may vary).
  • Open this file in notepad or any editor you use. Search for the word “DocumentRoot” or the line looks similar to (most probably line no 178):
DocumentRoot “c:/wamp/www/”
  • Change it to :
 DocumentRoot “C:/Users/Abhishek/Dropbox/www/”
  • Notice the slashes used, only forward slashes can be used don’t use backward slashes.
  • On around line no 205 you will find :
  • Change it to :
C:/Users/Abhishek/Dropbox/www/“>
  • Save and close the files.

Now you have saved all your files on the cloud which is enabled with Automatic Version system, Automatic Backup, Automatic Sync. Lets proceed to the database:

  • Open the file my.ini located in “C:wampbinmysqlmysql5.5.20my.ini“and find a variable declaration datadir (line no: 39) and change its address to “C:/Users/Abhishek/Dropbox/database/“.
  • In the same folder you would find a folder named data copy its content to the following location “C:/Users/Abhishek/Dropbox/database/“.
  • Restart your Wamp server.

Thats all.

You have configured your localhost to stay synced with dropbox. And dropbox keeps all your devices synced. Just follow the steps on all your devices.

Note: Never delete the content of folder in “C:wampbinmysqlmysql5.5.20data“.

So now you have a real-time backup system for your web applications, and a fast and easy local server, I hope this post has helped you in some way. You have any Suggestions, Ideas or doubt? Share them in comment section below.
Thanks. Happy coding…

Share this post

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email