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 :
  • 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…




Got Something To Say:

Your email address will not be published. Required fields are marked *


Thanks for that! This is a very useful article =)

Awesome, only problem when doing it with 2 computers.Seems like the database folder gives problems.Do you have a solution for that?

# Disable Federated by defaultskip-federatedAnd add this below:skip-innodbdefault-storage-engine=MyISAMin my.ini did the trick

Very nice – but it doesn't work for me. I get this error:MySQL returnerede: #2002 – No connection could be made because the target machine actively refused it.The server is not responding (or the local server's socket is not correctly configured). I have tried denny's trick, but didn't work neither ๐Ÿ™

Great, thanksI followed your steps and it worked perfectly for me, except for when I installed drupal in Dropbox.Everything went well, until I was asked to enter a name for a database.I got the following errorFailed to connect to your database server. The server reports the following message: SQLSTATE[HY000] [1049] Unknown database 'drupaldb'.How can i fix this? (drupaldb is the name of the db)

Hi,can you please be more specific about the time (just after installing drupal/after few days of working with drupal) and palce where you get this error? So that I can help you.You may check for the presence of database in phpMyAdmin.

hello kitepro,you may have to provide permission to access database. If you did not changed anything else in my.ini then try restarting mysql sever. Check database login details you are using. As per my knowledge this issue can not be related to dropbox sync. If still error occurs provide me with details how you are trying to connect to your database.

Hello,This trick works best for backup purpose only. In case of files it can work with multiple computers too. But If you try syncing 2 Systems databases it will create problem as MySQL store system specific ID's and if you are working on 2 systems at the same time it will not sync at all, as both of the servers would try to update same file and result in duplicate files. So I would suggest you to use this trick to syncing your code files and to backup your database files.denny's trick will work but if you are using RDBMS then MyISAM is not a good choice.Sorry for the late reply.

Thanks denny. Nice trick when relational DB's are not required DB. ๐Ÿ™‚

This comment has been removed by the author.

Apache works fine. However I had an InnoDB database in MysSQL and I couldn't start it. Does anyone know how I can fix it?This is a correct log when MySql Server starts from my c:/wamp130221 23:28:03 [Note] Plugin 'FEDERATED' is disabled.130221 23:28:03 InnoDB: The InnoDB memory heap is disabled130221 23:28:03 InnoDB: Mutexes and rw_locks use Windows interlocked functions130221 23:28:03 InnoDB: Compressed tables use zlib 1.2.3130221 23:28:03 InnoDB: Initializing buffer pool, size = 128.0M130221 23:28:03 InnoDB: Completed initialization of buffer pool130221 23:28:03 InnoDB: highest supported file format is Barracuda.130221 23:28:03 InnoDB: Waiting for the background threads to start130221 23:28:04 InnoDB: 1.1.8 started; log sequence number 1601605130221 23:28:04 [Note] Server hostname (bind-address): '(null)'; port: 3306130221 23:28:04 [Note] – '(null)' resolves to '::';130221 23:28:04 [Note] – '(null)' resolves to '';130221 23:28:04 [Note] Server socket created on IP: ''.130221 23:28:04 [Note] Event Scheduler: Loaded 0 events130221 23:28:04 [Note] wampmysqld: ready for connections.Version: '5.5.24-log' socket: '' port: 3306 MySQL Community Server (GPL)130221 23:33:16 [Note] wampmysqld: Normal shutdownAnd this is the log when I try to start it from dropbox (I have had copied data folder and changed my.ini according to the directions)130221 22:38:33 [Note] Plugin 'FEDERATED' is disabled.wampmysqld: Table 'mysql.plugin' doesn't exist130221 22:38:33 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.130221 22:38:33 InnoDB: The InnoDB memory heap is disabled130221 22:38:33 InnoDB: Mutexes and rw_locks use Windows interlocked functions130221 22:38:33 InnoDB: Compressed tables use zlib 1.2.3130221 22:38:33 InnoDB: Initializing buffer pool, size = 128.0M130221 22:38:33 InnoDB: Completed initialization of buffer poolInnoDB: The first specified data file .ibdata1 did not exist:InnoDB: a new database to be created!130221 22:38:33 InnoDB: Setting file .ibdata1 size to 10 MBInnoDB: Database physically writes the file full: wait…130221 22:38:34 InnoDB: Log file .ib_logfile0 did not exist: new to be createdInnoDB: Setting log file .ib_logfile0 size to 5 MBInnoDB: Database physically writes the file full: wait…130221 22:38:34 InnoDB: Log file .ib_logfile1 did not exist: new to be createdInnoDB: Setting log file .ib_logfile1 size to 5 MBInnoDB: Database physically writes the file full: wait…InnoDB: Doublewrite buffer not found: creating newInnoDB: Doublewrite buffer createdInnoDB: 127 rollback segment(s) active.InnoDB: Creating foreign key constraint system tablesInnoDB: Foreign key constraint system tables created130221 22:38:38 InnoDB: Waiting for the background threads to start130221 22:38:39 InnoDB: 1.1.8 started; log sequence number 0130221 22:38:40 [Note] Server hostname (bind-address): '(null)'; port: 3306130221 22:38:40 [Note] – '(null)' resolves to '::';130221 22:38:40 [Note] – '(null)' resolves to '';130221 22:38:40 [Note] Server socket created on IP: ''.130221 22:38:40 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

Great suggestion just a problem.As a result I can enter phpadmin and create databases which are done directly in dropbox database folder.My dropbox/www folder was empty so I copied all the existing contents of my wamp/www folder into it.When I open localhost I get this message."Unable to open WampServer's config file, please change path in index.php file"Where did I go wrong?

You did it all right, just one more step. You need to modify index.php under www folder. This the file responsible for the default page you see on accessing localhost. Look around for a relative address to the Wamp's config file in index.php and change it to absolute address. Thats all. ๐Ÿ™‚

It seems that you missed one/two steps. I guess you skipped copying the content of mysql to dropbox. Try one more time and let me know if problem persists..

Great tips for web development. Thanks for sharing wamp server and php file with mysql database.

Do I move all the files in my wamp local folder on to the dropbox server or just the www files?

Copyright © 2018. All Rights Reserved.