Click to See Complete Forum and Search --> : FoxServ 3.0 Installed...Now What?


Paul Jr
11-04-2003, 11:32 PM
I got FoxServ 3.0 installed, correctly, I think.
Now I'm not exactly sure what I do, or how I go about doing it. Any help would be greatly appreciated.

Perfidus
11-05-2003, 09:15 AM
Start doing your first php experiments by writing them with Notebook and placing them in to the localhost directory.
Buy a manual or follow some of the nice begginners tutorials all around internet.

Godd luck!

pyro
11-05-2003, 10:18 AM
To test PHP, try a very simple script such as this:

<?PHP
echo "I have PHP.";
?>

Paul Jr
11-05-2003, 02:02 PM
Question: What and where is the Localhost directory?

Sorry, I'm as new at this as anyone can possibly be.

Perfidus
11-05-2003, 02:10 PM
Go to C:/ and look for foxserv folder, there you will find a www folder. I think this is localhost.
:D

pyro
11-05-2003, 02:13 PM
The default for Apache 1 is C:\Program Files\Apache Group\Apache\htdocs while the default for Apache 2 is C:\Program Files\Apache Group\Apache2\htdocs. It'd possible that it is different for you, though, as you used an installer.

Paul Jr
11-05-2003, 02:23 PM
Well, apparently we are having a little problem.

<?PHP echo "I Have PHP."; ?>

Displays nothing at all.

pyro
11-05-2003, 02:48 PM
What happens when you type http://127.0.0.1/ in your browser? Do you get a default Apache page?

Paul Jr
11-05-2003, 03:08 PM
Nope. I get the good ol', extremely annoying, "Cannot find server" page.

pyro
11-05-2003, 03:27 PM
Then it would appear that your server is not properly installed. Having never used FoxServ, I have no clue what it is doing, and thus what the problem could be... :(

Paul Jr
11-05-2003, 07:17 PM
I'm with you there. I have no past experiece with any of this stuff. So...I'm completely lost? I think my best bet would just buy some hosting, it would be a lot easier than this. I'm only doing this because it's the only way I can practice PHP without paying for hosting.

pyro
11-05-2003, 09:01 PM
The easiest server I've ever seen to set up a server is to use Abyss Web Server with the CGI build (suicide :D) of PHP. It's basically install both packages, follow the instructions to add PHP support (found on Aprelium's site), and it should work.

Paul Jr
11-05-2003, 09:07 PM
Ah, see, that's the first thing I tried before this, and I had the same problem.


<?PHP echo "I have PHP!"; ?>
Displayed nothing at all.

pyro
11-05-2003, 09:10 PM
I would concentrate on making sure the server is running correctly first, then try to get support for PHP working.

Paul Jr
11-05-2003, 09:41 PM
Alright, I'm here, http://www.php.net/downloads.php, and I'm a tad confused about which of these links I'm supposed to use to download the correct version for my OS and such.

pyro
11-05-2003, 09:59 PM
Did you make sure the server is running correctly? If so, which one are you using?

Paul Jr
11-05-2003, 11:13 PM
The server is running correctly, as far as I know, because I have not seen anything that states otherwise.


I re-downloaded Abyss Web Server.

pyro
11-06-2003, 06:54 AM
So, when you type in http://127.0.0.1/ or http://localhost/ in your browser, you get a web page? Note that you may need to add a port to the end of that, if the server isn't running on port 80.

Paul Jr
11-06-2003, 11:40 AM
Yes, I get a webpage when I type that in.

pyro
11-06-2003, 11:53 AM
Ok, then try downloading the CGI version of PHP (http://us4.php.net/get/php-4.3.4-installer.exe/from/a/mirror) and follow the instructions (http://www.aprelium.com/abyssws/php.html), after you have loaded it in.

Paul Jr
11-06-2003, 04:49 PM
Alright! Thanks a lot for your help. I really, really apreciate it.

pyro
11-06-2003, 05:28 PM
Sure thing... Hope that works for you. :)

Paul Jr
11-06-2003, 05:37 PM
YAY!!! IT WORKS!!! PRAISE PRYO AND HIS GENIUS!!!

pyro
11-06-2003, 05:40 PM
Awesome... :)

Paul Jr
11-06-2003, 06:05 PM
Yes, It's PHAT!!! I am eternally greatful for your help, Pyro. I'll probably need more of it in the future, now that I can muck around with a Server Side Language.

pyro
11-06-2003, 06:15 PM
Happy to help. :cool:

Paul Jr
11-06-2003, 07:16 PM
Okay, this an excruciatingly easy problem -- for everyone but me ;).


I was looking at this page, http://hotwired.lycos.com/webmonkey/01/48/index2a_page6.html?tw=programming, and I decided to try it myself. But alass, the information which is entered in the tex boxes does not show up, as it should, according to the site.

Form Code

<html>
<head>
<title>Enter Info</title>
</head>
<body>

<form action="C:\Program Files\Abyss Web Server\htdocs\stuff.php" method="post">

Your favorite color(s):<br>
<input type="text" name="stuff1"><br><br>

Your favorite car is:<br>
<input type="text" name="stuff2"><br><br>

<input type="submit" name="submit" value="Submit Information">

</body>
</html>




Results

<html>
<head>
<title>Enter Info</title>
</head>
<body>

Your favorite car would most likely be a <?PHP echo $stuff1; echo $stuff2; ?>

</body>
</html>

pyro
11-06-2003, 08:07 PM
Take a look at http://www.webdevfaqs.com/php.php#globalvariables to see why that did not work.

Paul Jr
11-06-2003, 08:21 PM
I changed the "Results" code to this:

Your favorite car would most likely be a
<?PHP
echo $_POST['stuff1'];
echo $_POST['stuff2'];
?>

But I still get nothing.

pyro
11-06-2003, 09:37 PM
I'm assuming that page (the one echoing the $_POST variables) is stuff.php, and that it is in the same directory as the page with the form. So, try this:

<form action="stuff.php" method="post">

Paul Jr
11-06-2003, 10:01 PM
Where are you suggesting I put that? In the stuff.php page, or the index page?

***EDIT***
If you mean in the index page, I've already done that.

pyro
11-06-2003, 10:18 PM
Try this simple test once, and try to build on it. I've not tested, but it should work fine.

<form action="somepage.php" method="post">
<input type="text" name="test">
<input type="submit" name="submit" value="submit">
</form>

And, somepage.php:

<?PHP
echo $_POST['test'];
?>

Paul Jr
11-06-2003, 10:38 PM
Nevermind, it works now. I'm not sure how, I was just fiddling around, but it works.

If I'm not mistaken, you should be able to visit it by clicking here: http://171.75.160.140:81

Paul Jr
11-06-2003, 10:42 PM
I've got another question.

Is there a way to have something display if certian requirements are met? For example, I want to have a certain message display if the person who is visiting the site has a certain IP Address.

pyro
11-06-2003, 10:46 PM
Yes, the if construct is basic to pretty much every language. It is used to evaluate conditions. Take a look: http://us4.php.net/manual/en/control-structures.php#control-structures.if

Paul Jr
11-06-2003, 10:51 PM
Okay, but how can I incorporate an IP Address check into that?

***EDIT***
On the stuff.php page, I added this:


<?PHP
if (
$stuff1 == red
)
{
echo "I like red too.";
}
else
{
echo "";
}
?>


But that didn't work.

Paul Jr
11-06-2003, 11:07 PM
Never mind, I fixed it. That whole $_POST, and $stuff1 thing again.

***EDIT***

Is there a way to have more things in the if statement? I'm not sure how exactly to phrase this...so, is this possible (I hope you get the idea)?



<?PHP
if ($_POST["stuff1"] == red, black, silver)
{echo "Those are cool colors!";}
else
{echo " ";}
?>




Sorry for posting so much and close together. :(

pyro
11-07-2003, 07:10 AM
Yes, it would look something like this:

]<?PHP
$stuff1 = $_POST['stuff1']; # set $stuff1 to the $_POST variable with the same name for ease of use

if ($stuff1 == "red" || $stuff1 == "black" || $stuff1 == "silver") {
echo "Those are cool colors!";
}
else {
echo " ";
}
?>

Paul Jr
11-07-2003, 12:35 PM
Ah, many thanks.

pyro
11-07-2003, 01:02 PM
You bet... :)