Connecting Tech Pros Worldwide Help | Site Map

Xampp Drag n drop php sites in htdocs for quick preview

Newbie
 
Join Date: Jul 2008
Posts: 2
#1: Jul 26 '08
Hi every one,
I'm new to xampp & configuring etc
I've installed, uninstalled,
& again with what looks like a successful install.
http://localhost/phpmyadmin/ apperas to be working
also xampp-control.exe shows

All I want to do is preview
some pre made php websites, I'm not
over interested in learning php code.

the install folder is "C:\xampp"
I've tried to change the
default documentroot "/xampp/htdocs" to "C:\www"

I've dragged and dropped a prebuilt
website I downloaded into
"C:\www" then checked in http://localhost/ only to get

Access forbidden!

You don't have permission to access
the requested directory.
There is either no index document or
the directory is read-protected.

If you think this is a server error, please contact the webmaster.
Error 403
localhost
07/26/08 19:38:24
Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5


when configuring the httpd.conf - Is there any importance between
forward & backward slashes? / or \ ?
Are there any other files that need to be configured to
get this to work?(if it is possible at all)

Please - All opinions & thoughts welcomed
Newbie
 
Join Date: Jul 2008
Posts: 2
#2: Jul 26 '08

re: Xampp Drag n drop php sites in htdocs for quick preview


Is this a common practice? - I mean is it posible to
drag n drop a pre-built php website in to the
htdocs folder and have it 'work' ??
Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,739
#3: Jul 27 '08

re: Xampp Drag n drop php sites in htdocs for quick preview


Hi.

Try giving a complete location to a file that you know exists.
Like say: "http://localhost/index.php"

If that gives you a 403 error, the file permission is probably incorrect.
Which version of Windows are you running?

In any case, try giving "Everybody" total access to the files. If that doesn't solve the problem, it could be a problem with the Apache configuration.
Newbie
 
Join Date: Aug 2008
Posts: 1
#4: Aug 12 '08

re: Xampp Drag n drop php sites in htdocs for quick preview


I wouldn't bother trying to move the default xampp htdocs directory, it will probably cause more problems then it's worth. Instead you should create a virtual host. That way you can specify as many hosts as you want and where you want the files to be on the drive.

I have xampp installed in: C:\xampp

And my vhosts are in: C:\home\hostname\public_html

Because on my real server, the linux directory layout is:
/home/hostname/public_html

Where "hostname" is the first eight characters of the actual host name.

"www.somewebsite.com" would have a path like (on bluehost, powweb, etc):
/home/somewebs/public_html/

So I would make a vhost on my drive like:
C:\home\somewebs\public_html\

Open w/ notepad: C:\xampp\apache\conf\httpd.conf

Change:

Expand|Select|Wrap|Line Numbers
  1. # Virtual hosts
  2. Include conf/extra/httpd-vhosts.conf
To:

Expand|Select|Wrap|Line Numbers
  1. # Virtual hosts
  2. Include conf/extra/httpd-vhosts.conf
  3. Include conf/vhosts/*.conf
Now make the folder: C:\xampp\apache\conf\vhosts

Create text file: C:\xampp\apache\conf\vhosts\00.conf
And add this:

Expand|Select|Wrap|Line Numbers
  1. NameVirtualHost *:80
  2. NameVirtualHost *:443
That code will get included first and it will be applied to all the other vhosts.

Using the "www.somewebsite.com" example (/home/somewebs/public_html/):
Create the text file: C:\xampp\apache\conf\vhosts\somewebs.conf
And add this:

Expand|Select|Wrap|Line Numbers
  1. <VirtualHost *:80>
  2.  
  3.     ServerAdmin webmaster@somewebs.com
  4.     ServerName www.somewebs.com
  5.  
  6.     ServerAlias *.somewebs.com
  7.  
  8.     DocumentRoot C:/home/somewebs/public_html
  9.  
  10.     ErrorLog logs/somewebs.com-error_log
  11.     CustomLog logs/somewebs.com-access_log combined
  12.     ScriptAlias /cgi-bin/ "C:/home/somewebs/public_html/cgi-bin/"
  13.  
  14.     <Directory "C:/home/somewebs/public_html/cgi-bin">
  15.         AllowOverride None
  16.         Options +ExecCGI -Includes
  17.         Order allow,deny
  18.         Allow from all
  19.     </Directory>
  20.  
  21.     <IfModule mod_userdir.c>
  22.         UserDir public_html
  23.     </IfModule>
  24.  
  25.     <Directory "C:/home/somewebs/public_html/">
  26.         Options Indexes FollowSymLinks Includes
  27.         AllowOverride All
  28.         Order allow,deny
  29.         Allow from all
  30.     </Directory>
  31.  
  32.  
  33. </VirtualHost>
  34.  
  35. <VirtualHost *:443>
  36.  
  37.     DocumentRoot "C:/home/somewebs/public_html"
  38.     ServerName www.somewebs.com:443
  39.     ServerAdmin webmaster@somewebs.com
  40.  
  41.     ErrorLog logs/somewebs.com-error_log
  42.     CustomLog logs/somewebs.com-ssl_request_log   ssl_combined
  43.     TransferLog logs/somewebs.com-access_log
  44.  
  45.     ScriptAlias /cgi-bin/ "C:/home/somewebs/public_html/cgi-bin/"
  46.  
  47.     SSLEngine on
  48.     SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
  49.     SSLCertificateFile conf/ssl.crt/server.crt
  50.     SSLCertificateKeyFile conf/ssl.key/server.key
  51.  
  52.   <FilesMatch "\.(cgi|shtml|phtml|php|php5|php4|php3?)$">
  53.       SSLOptions +StdEnvVars
  54.   </FilesMatch>
  55.   <Directory "C:/home/somewebs/public_html/cgi-bin">
  56.       SSLOptions +StdEnvVars
  57.   </Directory>
  58.  
  59.     #   SSL Protocol Adjustments:
  60.     SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
  61.  
  62. </VirtualHost>
Open w/ notepad: C:\WINDOWS\system32\drivers\etc\hosts
And below "127.0.0.1 localhost" add:

Expand|Select|Wrap|Line Numbers
  1. 127.0.0.1 www.somewebs.com
  2. 127.0.0.1 somewebs.com
Open: C:\home\somewebs\public_html\
And create an index.html file - and in it put: "Hello World!".

In your browser, go to: www.somewebs.com
And it should say "Hello World!" on a white screen.

So now you have the real site at: www.somewebsite.com
And the virtual site at: www.somewebs.com

------------------------------------------------

To make another vhost, copy "C:\xampp\apache\conf\vhosts\somewebs.conf" to like: C:\xampp\apache\conf\vhosts\tempuser.conf

Open "tempuser.conf" and rename (in this order):
www.somewebs.com to www.tempuser.com
somewebs.com to tempuser.com
somewebs to tempuser

Then add this to the "C:\WINDOWS\system32\drivers\etc\hosts" file:
Expand|Select|Wrap|Line Numbers
  1. 127.0.0.1 www.tempuser.com
  2. 127.0.0.1 tempuser.com
And create (Hello World!): C:/home/tempuser/public_html/index.html

Repeat as necessary.

------------------------------------------------

Now you can drag n drop html sites into the virtual host directory and view them. PHP based site will work too but if they require a database, it will have to be created and populated with phpMyAdmin before you can view the site.
Reply