Location of HTML/PHP Files

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

Location of HTML/PHP Files

Postby DoctorT » 10. January 2017 20:30

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
DoctorT
 
Posts: 6
Joined: 10. January 2017 16:51
XAMPP version: 3.2.2
Operating System: Windows 7 Pro

Re: Location of HTML/PHP Files

Postby Altrea » 10. January 2017 20:40

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Location of HTML/PHP Files

Postby DoctorT » 10. January 2017 21:23

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
DoctorT
 
Posts: 6
Joined: 10. January 2017 16:51
XAMPP version: 3.2.2
Operating System: Windows 7 Pro

Re: Location of HTML/PHP Files

Postby Altrea » 10. January 2017 21:59

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Location of HTML/PHP Files

Postby DoctorT » 10. January 2017 22:32

Dear Altrea,

Thank you for your reply.

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

Dr. T
DoctorT
 
Posts: 6
Joined: 10. January 2017 16:51
XAMPP version: 3.2.2
Operating System: Windows 7 Pro

Re: Location of HTML/PHP Files

Postby Altrea » 10. January 2017 23:11

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.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Location of HTML/PHP Files

Postby dcromley » 05. February 2017 02:13

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 ?
dcromley
 
Posts: 1
Joined: 22. December 2011 21:33
Location: Wyoming, USA
XAMPP version: 5.6.30
Operating System: Windows 10

Re: Location of HTML/PHP Files

Postby Altrea » 05. February 2017 14:11

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.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 139 guests