Where are the php documents to be put?

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Where are the php documents to be put?

Postby nicolet » 28. March 2015 11:12

My first test

I have installed MAMP on my MacBook (Mac OS X 10.10). For a first experience I want to use a very simple example:

<!DOCTYPE html> <!-- formDataRead.html -->
<html>
<head>
<meta charset="utf-8" >
<title>A simple HTML form</title>
</head>
<body>
<form action="formDataRead.php" method="GET">
<input type="text" name="user">
<br>
<textarea name="address" rows="5" cols="40"></textarea>
<br>
<input type="submit" value="hit it!">
</form>
</body>
<!-- source: http://www.java2s.com/Code/Php/Form/ASimpleHTMLForm.htm -->
</html>

<html> <!-- formDataRead.php -->
<head>
<title>Reading input from the form</title>
</head>
<body>
<?php
print "Welcome <b>$user</b><P>\n\n";
print "Your address is:<P>\n\n<b>$address</b>";
?>
</body>
</html>

I suppose that the first document may be located anywhere on my disk (the client).
But where is the second document (for the server) to be located?

François
nicolet
 
Posts: 3
Joined: 27. March 2015 11:23
Operating System: Mac OS X 10.10.2

Re: Where are the php documents to be put?

Postby Nobbie » 28. March 2015 22:00

nicolet wrote:I suppose that the first document may be located anywhere on my disk (the client).


No, thats wrong. All documents have to be put under the "DocumentRoot", this is configured in httpd.conf
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: Where are the php documents to be put?

Postby nicolet » 29. March 2015 17:41

Thank you, Nobbie, for your prompt reply. But: what is "DocumentRoot" and where is it? How do I access it?
Or, more generally: I there a detailed step-by-step instruction explaining how to run my very first HTML/PHP pages?
François
nicolet
 
Posts: 3
Joined: 27. March 2015 11:23
Operating System: Mac OS X 10.10.2

Re: Where are the php documents to be put?

Postby Altrea » 29. March 2015 19:04

The default DocumentRoot for XAMPP Apache on Mac OS X is /Applications/XAMPP/xamppfiles/htdocs.
Your files needs to be placed there (or in a subfolder of it)
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: Where are the php documents to be put?

Postby Nobbie » 30. March 2015 09:19

nicolet wrote:Thank you, Nobbie, for your prompt reply. But: what is "DocumentRoot" and where is it?
François


See http://httpd.apache.org/docs/current/en ... cumentroot

You should also Google for some Apache Tutorials to get an impression how to manage and configure Apache.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: Where are the php documents to be put?

Postby nicolet » 03. April 2015 16:46

Thank you, Beltran. I think I'm trying to use the wrong tool. My intention was to read from text input fields, process the input and store it in a file. JavaScript purposely has been designed so that it cannot write on client's disk. Instead of installing a server on the same machine, I should use another programming environment, e.g. Java.

Thanks and best regards
François
nicolet
 
Posts: 3
Joined: 27. March 2015 11:23
Operating System: Mac OS X 10.10.2


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 6 guests