apache icon
27th
May 10

Using a Windows NTFS XAMPP / Apache Install on a Linux Apache Server

Posted Thursday 27th May 2010
About a year ago I wrote about how to “map” the Linux EXT3 FS in Windows so you could use it with Apache on a Windows installation. Now I’ll be explaining how to use a your htdocs and MySQL databases from a Windows NTFS (XAMPP) install on Ubuntu Linux.

Today I really wanted to use Ubuntu at work as I find it a lot more efficient and quicker to do a lot of web related development. I have about a years worth on work on a Windows installation and wanted to be able to use that seamlessly with my Linux installation with minimum fuss. Here’s a quick way to do that.

To view your htdocs (or the equivalent) you can either setup a symbolic link or edit the Apaches httpd.conf file. I chose to configure Apache by editing the httpd.conf file and adding the path to my NTFS directory.

You’ll most likely need to edit httpd.conf as root (or sudo):

1
sudo gedit /opt/lampp/etc/httpd.conf

Point the DocumentRoot root path to the NTFS location

1
2
#DocumentRoot "/opt/lampp/htdocs"
DocumentRoot "/media/F090D6FF90D6CAEC/xampp/htdocs"

And also the directory setup

1
2
#<Directory "/opt/lampp/htdocs">
<Directory "/media/F090D6FF90D6CAEC/xampp/htdocs">

The easiest way to use your Windows MySQL databases is to create a symbolic link. A default XAMPP install on Linux typically installs MySQL data to /opt/lampp/var/. On Windows, however, it’s usually found at C:\xampp\mysql\data. To create a symbolic link (do not copy and paste below) looks similar to;

1
ln -s /media/NTFS-DRIVE-HERE/xampp/mysql/data /opt/lampp/var/mysql/

Access Forbidden

If you get an Access Forbidden 403 Error then there are most likely read or write issues on the NTFS drive and you can use fstab to provide more permissions.

MountManager is a KDE application that provides a comprehensive yet easy to use interface for managing device mounting. You can get it with;

1
sudo apt-get install mountmanager

If you don’t know how to configure fstab take a look at https://help.ubuntu.com/community/Fstab as it’s well worth investing a few minutes to learn. To edit the fstab configuration file run this from a terminal;

1
sudo gedit /etc/fstab

phpMyAdmin Errors

If you install Apache and MySQL (or XAMPP/LAMPP) and have different passwords then phpMyAdmin will inevitable throw some errors. For example;

#1045 - Access denied for user 'root'@'localhost' (using password: NO) 

The first step to resolve phpMyAdmin errors is to check the config.inc.php file has the correct username and password set up. On a default XAMPP install it can be found in /opt/lampp/phpmyadmin. Do a search for $cfg['Servers'][$i]['user'] and change them so they’re correct like below;

1
2
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'your-password';

It’s that easy. If you’re running into any problems just leave a comment.

Bookmark or share this page:

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon

Related posts:

  1. Mapping Linux (ext3) File System for use in Apache under Windows


MSN Contact: contact [at] danielgibbs.net



6 Comments

  1. Mimi 6 October 2010 10:53 am

    Hi …thank you for this information on your site.

    It has been answering most of the issues I’ve had with changing the DocumentRoot to an ntfs partition, but I’m still having no luck in getting the SQL database to work. I’m wondering if you might be able to help?

    (to clarify, I have Linux Mint 9 with LAMP installed.) …when I try to set up a symbolic link to mysql, I get `/var/lib/mysql/data’: Permission denied …..is it as simple as changing permissions to this location? I’m not certain if that’s an ok thing to do?

    Thanks

  2. Gibbs 6 October 2010 11:09 am

    Hi Mimi,

    I really need to revise this post but glad it has helped in the meantime.

    In regard to your question. I wouldn’t change the permissions for the data directory incase you use it in future. Instead just create the symbolic link as root (super user on Linux Mint).

    sudo ln -s /media/NTFS-DRIVE-HERE/path/to/mysql/data /var/lib/mysql/data/

    Let me know how you get on.

  3. Mimi 6 October 2010 7:35 pm

    Aahhh of course! Thanks for getting back to me so quickly.

    I either seem to have the wrong path though, or there’s some other problem with connecting to the database ! …I’ll keep plugging away at it

    Thanks again

  4. Gibbs 6 October 2010 9:00 pm

    A few suggestions. You could try change the path (usually) in /etc/my.cnf. For example: innodb_data_home_dir = /media/NTFS-DRIVE/path/to/mysql/data

    Are you receiving any specific errors? Is MySQL still running on Mint?

    All the symbolic link does is point MySQL to the databases and tables on the NTFS partition/drive – to use them instead.

    Another problem might be permissions for the NTFS filesystem. When mounting you might want to try having umask=0000 (global read/write permissions) just to test that isn’t the issue.

    Hope that helps. Keep plugging away, you’ll get there :)

  5. Mimi 9 October 2010 9:49 am

    Hi …sorry about taking so long. I didn’t see the email that your message was here….

    ok …I have made huge progress. Even while writing a reply to you and this is now my 3rd edit!! haha

    (I’ll write some details and history here just in case someone else might be able to get something out of it….)

    First I had issues with phpmyadmin not working. Something about Wrong permissions. Didn’t like World Writeable. I played around with umask in fstab to the ntfs partition (changing from 0000 to 0222 etc), but I don’t think that worked? I think what did work was changing /etc/phpmyadmin/config.inc.php permissions to 644. I say ‘think’, because even though I restarted (and reloaded) apache2 after changing permmissions, phpmyadmin still wasn’t working. But when I rebooted my computer this morning, hey-presto. All of a sudden it was working.

    So…. phpmyadmin working, but still not finding the databases on the ntfs partition.

    I had setup the symbolic link and could see it when viewing in Nautilus file browser in /var/lib/mysql. The link was set to ‘data’, as I wrote earlier. Then it dawned on me, there is a database called ‘data’ showing up in phpMyAdmin… but of course it had no tables in it. Then I realised that I had to set up symbolic links to the specific databases!!! (3 of them)

    Yeyyy… now they all show up in phpMyAdmin and all of their tables. Keewwwl!!!

    But, when I go to view the website, it still comes up with an error that it was unable to connect to the database. :( I’m guessing that might have something to do with paths in the html files? …but it’s doing my head in, at the moment, trying to figure out what that should be?

    If you have any ideas, please do let me know :)

TrackBack URL

Leave a comment