Page 1 of 1

Location of HTML/PHP Files

PostPosted: 10. January 2017 20:30
by DoctorT
Hi!

I am running XAMMP 3.2.2 under Windows 7 Pro. The server is currently configured as follows:

Server root:

ServerRoot "C:/xampp/apache"

The document root:

DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">

How do I change the document root so that http://localhost/file_name.php looks at the drive and folder where I currently keep my files? That drive/folder is:

N:\HOBBY\PAINTING\WEB\file_name.php

I don't think that I have to change the server root. Right?

Thank you!

Dr. T

Re: Location of HTML/PHP Files

PostPosted: 10. January 2017 20:40
by Altrea
Hi,

DoctorT wrote:I am running XAMMP 3.2.2

No you are not. Please red the following thread to get more knowledge about xampp version numbers and where to find them:
[Q&A] Insufficient debug information - base information

DoctorT wrote:How do I change the document root so that http://localhost/file_name.php looks at the drive and folder where I currently keep my files?

Either change the DocumentRoot directive or use VirtualHosts to use a new DomainName (you need for sure set access rules in Apache and make sure this domain is resolvable - windows hosts file or dns)

best wishes,
Altrea

Re: Location of HTML/PHP Files

PostPosted: 10. January 2017 21:23
by DoctorT
Dear Altrea,

How do I change the document root? Do I change both lines as shown below?

DocumentRoot "N:/HOBBY/PAINTING/WEB"
<Directory "N:/HOBBY/PAINTING/WEB">

Thank you!

Dr. T

Re: Location of HTML/PHP Files

PostPosted: 10. January 2017 21:59
by Altrea
yes, both lines.
The first line sets the DocumentRoot and the second one sets the specific directory options like permissions, etc.

Keep in mind that the default xampp dashboard is unreachable after changing the DocumentRoot

Re: Location of HTML/PHP Files

PostPosted: 10. January 2017 22:32
by DoctorT
Dear Altrea,

Thank you for your reply.

What is the default xampp dashboard? Do I need it? How would I use it>

Dr. T

Re: Location of HTML/PHP Files

PostPosted: 10. January 2017 23:11
by Altrea
If Apache is started and you click on the Admin Button next to Apache in your control panel
or you open your browser and type in http://localhost/dashboard/ that is the dashboard.
I don't know if you need it. I don't need it, but can be handy for beginners.

Re: Location of HTML/PHP Files

PostPosted: 05. February 2017 02:13
by dcromley
Thanks for this thread.
1) This is natural followup, but should I have started another thread?
2) The natural followup -- does the DocumentRoot have restrictions like
2a) it has to be under c:/xampp/htdocs or
2b) it has to be under c:/xampp ?

Re: Location of HTML/PHP Files

PostPosted: 05. February 2017 14:11
by Altrea
dcromley wrote:2) The natural followup -- does the DocumentRoot have restrictions like
2a) it has to be under c:/xampp/htdocs or
2b) it has to be under c:/xampp ?

No. The only restriction is that the user Apache is running from does have access to this path.