Using same htdocs folder with xampp for windows

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Using same htdocs folder with xampp for windows

Postby dungpq » 24. February 2009 09:04

Hi everybody, im newbie here,
Today i decided to install ubuntu on my laptop (I've installed Win XP with xampp 1.70 for windows first). After that, I install Xampp 1.70 for linux.
Go to http://localhost/, it's work nomally.
But I'm PHP developer, I have all code in C:\xampp\htdocs (xampp for windows), now I want to run it in Linux environment. So I edit the httpd.conf file. change DocumentRoot to /media/WinXP/xampp/htdocs (the Linux's path of C:\xampp\htdocs).
After restart apache, I go to http://localhost/, it said that "Forbidden" !!!, its look like cannot have permission of /media/WinXP/xampp/htdocs

I'm new to Ubuntu, can anyone helpme

:( :( :( :(
dungpq
 
Posts: 2
Joined: 24. February 2009 08:51

Re: Using same htdocs folder with xampp for windows

Postby Wiedmann » 24. February 2009 14:32

So I edit the httpd.conf file. change DocumentRoot

You have also changed the associated "<Directory>" directive?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: Using same htdocs folder with xampp for windows

Postby dungpq » 26. February 2009 03:57

yes I've also changed, but i still get 403 error

OK, but after many hours, I've found solution !!!!!!!

----------------------------- COMPLETE SOLUTION ---------------------------------------------------
1, First, Install xampp in your system (i use ubuntu 8.1), dont start it !! (if u are running, stop it by sudo -u root /opt/lampp/lampp stop )
2, OK, my Ubuntu account login name is "dungpq", u must replace it by your login name
apache running with www-data account, not root account, so if u mount the windows's xampp drive (Eg. <WinXP>C:\ mount to /media/WinXP/), www-data cannot access this dir => U will get 403 error if u change DocumentRoot to htdocs folder in windows's xampp htdocs
=> U must mount the drive which has windows xampp installed to another folder (which www-data can access)
I will mount it to /home/dungpq/WinXP

Before mount WinXP to /home/dungpq/WinXP, u must unmount this
sudo -u root umount /media/WinXP

ok, now edit fstab
sudo -u root gedit /etc/fstab

place this code in bottom of file
# WInXP drive - DungPQ@informa
/dev/sda6 /home/dungpq/MISC auto rw,exec,auto,user,sync,umask=0000 0 0

now remount this
sudo -u root mount /dev/sda6

Remember !! (sda6 is name of your drive)
ok, now the windows's xampp drive can be accessed by everyone (including www-data)

now edit the httpd.conf file
sudo -u root gedit /opt/lampp/etc/httpd.conf

Find "/opt/lampp/htdocs" and replace by "/home/dungpq/WinXP/xampp/htdocs"
(u will find 2 line contain it)

save and close this file.
Now start xampp
sudo -u root /opt/lampp/lampp start

go to http://localhost/, u will access the htdocs folder of windows's xampp !!!!!

But, now, u need use mysql database from windows's xampp, right ?
First stop xampp
sudo -u root /opt/lampp/lampp stop

now create simple bash file, make link from windows's xampp mysql data folder to linux's xampp mysql data folder

#!/bin/bash
# Create link to windows xampp myql data folder
# DungPQ@informa

for i in $( ls "/home/dungpq/WInXP/xampp/mysql/data");
do
if [ $i != "ibdata1" ]; then
if [ $i != "ib_logfile0" ]; then
if [ $i != "ib_logfile1" ]; then
if [ $i != "mysql" ]; then
if [ $i != "phpmyadmin" ]; then
if [ $i != "test" ]; then
ln -s /home/dungpq/WinXP/xampp/mysql/data/$i /opt/lampp/var/mysql/$i;
fi
fi
fi
fi
fi
fi
done

Run it by root access, and all mysql data from windows's xampp will be show in mysql data list of linux's xampp

start xampp again
sudo -u root /opt/lampp/lampp start

OK, now u can use the same htdocs file and database between windows and linux
Thanks
dungpq
 
Posts: 2
Joined: 24. February 2009 08:51

Re: Using same htdocs folder with xampp for windows

Postby martez81 » 25. March 2010 03:40

Sorry for digging out old thread.


->dunpg
I'm also a PHP developer, but I'm still newbie with Linux. I have stumbled upon the same problem when starting using LAMPP. In your solution you mounted windows partition as root. Is it safe to do?
Is there a possibility to mount only a folder with web documents as root or "nobody", and the rest of data as regular user?
martez81
 
Posts: 1
Joined: 25. March 2010 03:30

Re: Using same htdocs folder with xampp for windows

Postby Gew » 06. December 2010 13:43

Any ideas which are up to date with current world as we see it?
I'd love to have an USB stick with an encrypted life diary.
Thing is, I'd like to be able to use it from Linux _and_ Windows.
The SQL db dir should be within a TrueCrypt container, of course.
The remaining issue is file system (for compatibility), big one huh?

Running NTFS on all part of the stick is preferred, right?
Will the -NIX version be able to execute i.e. daemons from NTFS?
Thankful for all news and ideas. A step-by-step guide would be awesome.

Regards~
User avatar
Gew
 
Posts: 1
Joined: 26. October 2010 17:57


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 53 guests