Help -- Changing Xampp DocumentRoot (to accomodate SVN)

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

Help -- Changing Xampp DocumentRoot (to accomodate SVN)

Postby FeralReason » 29. August 2009 16:37

I have been developing on XP with the default DocumentRoot statement in the httpd.conf file: DocumentRoot "C:/xampp/htdocs".

We just implemented svn for version control and all my source is now in my local svn directory --> C:/xampp/fp/httpdocs. (I am totally new svn/version control.)

I changed the httpd.conf file entry to
DocumentRoot "C:/xampp/fp/httpdocs"
Rebooted (likely unnecessary), restarted the xampp control panel and IE.
Tried to bring up a file in IE (URL: http://localhost/mytestfile.php) and got an "Access forbidden!" message.

Do I need to do something beyond changing the DocumentRoot line in the httpd.conf (or should I perhaps be posting this on some svn forum) ?

Thanx in advance for any help !
FeralReason
 
Posts: 19
Joined: 16. April 2009 20:42

Re: Help -- Changing Xampp DocumentRoot (to accomodate SVN)

Postby Nobbie » 29. August 2009 18:29

>Do I need to do something beyond changing the DocumentRoot line in the httpd.conf ... ?

Yes.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

Re: Help -- Changing Xampp DocumentRoot (to accomodate SVN)

Postby dmphotography » 29. August 2009 21:11

@FeralReason;

Check out my tutorial dealing with virtual hosts in XAMPP:
http://www.myownserver.info/additional-configurations-and-settings-linux/47-linuxmultiplewebsiteconfiguration.html

The same settings apply httpd.conf file if only using one website.

The error you're probably getting is a 403 error. (Always post the error number when posting error problems)

It's easy to fix using directive(s) in your Apache configuration.
I recommend reading up on the directives to understand them and know exactly what you're telling it to do.

As far as restarting goes, that is unnecessary. All you have to do is restart Apache once you've saved your
changes and the new settings will be applied. If it doesn't start, make sure you don't have any mis-spellings
because errors in the configuration file will cause Apache to not start up.
For great video and written tutorials and guides on creating your own web server and installing things such as forums, blogs, etc., visit http://myownhomeserver.com
dmphotography
 
Posts: 191
Joined: 15. December 2008 14:25
Location: Columbus, MS
Operating System: Windows 7

Re: Help -- Changing Xampp DocumentRoot (to accomodate SVN)

Postby Izzy » 29. August 2009 23:48

FeralReason wrote:Do I need to do something beyond changing the DocumentRoot line in the httpd.conf...
Glenn, the <Directory "C:/xampp/htdocs"> Directive must be set to the same as your DocumentRoot - this is the reason for the access denied error message as all directories, except those Aliased or Virtual Hosted, outside the DocumentRoot have access denied for obvious security reasons.

This sameness is explained in the comments of the httpd.conf file...
Code: Select all
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/xampp/htdocs">
...and for future reference, these and all comments are well worth reading before making any changes in the httpd.conf file.

Also be aware that changing things in any conf or ini file requires first a backup copy be made then, in case you are not able to start the component after editing, you can revert to the backup copy to get you on the road again.


BTW it is not always a good idea to alter the default "out of the box" Apache settings as there are usually alternate methods to achieve your goals.


For Example:
You can use the Alias directive for your SVN files and edit the C:\xampp\apache\conf\extra\httpd-xampp.conf file where you will see some configurations already included and working.

This Alias method may work for your SVN after first returning your httpd.conf file back to the defaults before you edited it - don't try this first without making a backup of both .conf files as mentioned above.

The Alias directive is explained here:
http://httpd.apache.org/docs/2.2/mod/mo ... html#alias


You can add your svn Alias after the webalizer Alias so both entries would look like this after editing:
(and remember to save the file and restart Apache after editing)
Code: Select all
Alias /webalizer "C:/xampp/webalizer/"
<Directory "C:/xampp4/webalizer">
<IfModule php5_module>
<Files "webalizer.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
</Directory>

Alias /svn "C:/xampp/fp/httpdocs/"
# if this is where you want to put your SVN files
# my choice would be "C:/xampp/svn/" perhaps
<Directory "C:/xampp/fp/httpdocs">
# or <Directory "C:/xampp/svn"> if you changed it
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# <Directory> entries are the same as for the DocumentRoot in the httpd.conf file
# You can add or change them to suit your SVN file's needs, but there should be no need
</IfModule>
For a list of all Directives and what they mean and what they do can be found here:
http://httpd.apache.org/docs/2.2/mod/directives.html

For a list of the Options directive go here:
http://httpd.apache.org/docs/2.2/mod/core.html#options

This URI should now work and access your files in the above C:\xampp\fp\httpdocs\ folder or in the C:\xampp\svn\ folder if you changed it in the Alias settings.
http://localhost/svn
(BTW is this the correct spelling of the folder you intended as usually htdocs refers to the DocumentRoot folder).

Words after the hash # character are my comments and may be removed if you use the above example in your own httpd-xampp.conf file.

This Alias or VirtualHost method will still allow you to access all the default XAMPP web pages as was intended by the XAMPP developers at the URI of http://localhost/


As an alternative to the Alias directive you could use a VirtualHost directive and for some good examples and lots of info do an Advanced forum search in this XAMPP for Windows English forum for keyword virtualhost or vhost and all the vhost configurations can be found in the C:\xampp\apache\conf\extra\httpd-vhosts.conf file.

Glenn, kindly let us know how you get on please.

Good luck with it.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: Help -- Changing Xampp DocumentRoot (to accomodate SVN)

Postby FeralReason » 30. August 2009 14:56

Izzy, Thanx much for your extensive reply ! I had missed the <Directory "C:/xampp/htdocs"> change. That did the trick -- must be going blind to have missed that one ! Thanx again !
FeralReason
 
Posts: 19
Joined: 16. April 2009 20:42


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 86 guests