Moving XAMPP mysql and htdocs dirs to Dropbox

If you are doing web development with XAMPP on more than one computer you might want try syncing your database and htdocs directory via Dropbox. I have only performed this maneuver on OS X, but I suspect the same thing will work for Windows.

First off, move your /Applications/XAMPP/xamppfiles/htdocs/ dir to a subdir of your Dropbox directory. My Dropbox is located at /Volumes/data1/Dropbox/ and I placed the htdocs dir at /Volumes/data1/Dropbox/XAMPP/htdocs/.

The htdocs path is set in the /Applications/XAMPP/xamppfiles/etc/httpd.conf file by changing the DocumentRoot path:

DocumentRoot "/Volumes/data1/Dropbox/XAMPP/htdocs"

The XAMPP mysql dir is by default located at /Applications/XAMPP/xamppfiles/var/mysql/. I moved mine to /Volumes/data1/Dropbox/XAMPP/mysql/. Edit the following lines in /Applications/XAMPP/xamppfiles/etc/my.conf to reflect the path change:

Under [client]:socket = /Volumes/data1/Dropbox/XAMPP/mysql/mysql.sock

Under [mysqld]:socket = /Volumes/data1/Dropbox/XAMPP/mysql/mysql.sock

Also, add under [mysqld]:datadir=/Volumes/data1/Dropbox/XAMPP/mysql/

That's it. If you get the "XAMPPErrorDomain error 1." when trying to start the mysqld via XAMPP Control you might have to experiment with less restrictive permissions on the xamppfiles dir.

你可能感兴趣的:(Moving XAMPP mysql and htdocs dirs to Dropbox)