FRIHOSTFORUMSSEARCHFAQTOSBLOGSCOMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP Test File





Tony The Tiger
I have browsed the PHP tutorial at W3Schools Online Web Tutorials (http://www.w3schools.com/ ). I think I understand why you all talk about frames as if the are an ancient programming style. I am experimenting with php. Below is the code I have written for a test file. I seem to be having trouble testing it. I essentially have five questions (with related questions).

1. Where do I put this code? Does it go in my root directory? Can I test it in said directory on my local hard drive or do I have to put it said directory on my remote webhost server which has PHP powers? Does it have to be in the same folder as the files it “requires” and any files they reference?

2. What are eligible names? phpheader.php, phpheader.htm, phpheader.html

3. How can I reference this code? Can I call it from a index.html file or index.php file? Can I just open this file by double clicking it once I have it named correctly?

4. Is phpbb sufficient or do I need nuke?

5. How, does one reference a left sidebar like one would have in the first column of a frameset?

<html>

<head>
<title>Test PHP Page</title>
</head>

<body>

<?php
//inserts the frame header file
require("header.html");
?>

<p> Some text </p>

<?php
//Prints something like: Monday January 15, 2003 05:51:38 AM
echo date("l F d, Y H:i:s A");
?>

</body>

</html>
Bondings
For every php script, you need to let the server know it's php. The most easiest way is to call the page <something>.php. Then the server handles the page and sends a html page to your browser/computer. The html doesn't really have much to do with the php, and so do the frames. If you want to test out frames, better try it out first with plain html and if that works ok, make the dynamic things with php.

To test it out on your own computer, you need to install apache on your computer, like easyphp. Uploading it to your account might be easier in most cases. The file needs to be somewhere in your public_html directory, as otherwise you won't be able to access it on the public internet.

To access that page (let's say you called it index.php and put it in your public_html directory of your something.frih.net subdomain), you need to type in your browser the url something.frih.net/index.php . If you remove the default index.html file, you only need to type something.frih.net to access your website.

PhpBB is a forum and phpNuke is a cms, you don't need them for a php script.

About the frames, you'll have to find someone else to answer you. I don't know anything about them.
Tony The Tiger
Bondings wrote:
To test it out on your own computer, you need to install apache on your computer, like easyphp.


Thanks for the detailed response. I am not sure what apache I need. I am here: http://www.apache.org/dyn/closer.cgi . When I choose a link I see a bunch of folders that don't necessarily make it clear what I need. I am also looking here: http://us2.php.net/downloads.php for stuff to download. Please advise.
Bondings
Tony The Tiger wrote:
Bondings wrote:
To test it out on your own computer, you need to install apache on your computer, like easyphp.


Thanks for the detailed response. I am not sure what apache I need. I am here: http://www.apache.org/dyn/closer.cgi . When I choose a link I see a bunch of folders that don't necessarily make it clear what I need. I am also looking here: http://us2.php.net/downloads.php for stuff to download. Please advise.

I would advise you to install http://www.easyphp.org/ . I use it and it is very easy in my opinion. It installs both apache and mysql+phpmyadmin. It will most likely be installed in your program files and have a www directory. You need to put the files in that directory, start easyphp and then access it with your browser, it will be http://localhost/page.php .
Tony The Tiger
Bondings wrote:
I would advise you to install http://www.easyphp.org/ . . . .It will most likely be installed in your program files and have a www directory. You need to put the files in that directory, start easyphp and then access it with your browser, it will be http://localhost/page.php .


Now I have got a file the location file:///C:/Program%20Files/EasyPHP1-8/www/date.php coming up in my browser. However, it is not really parsing (or is it scripting) correctly. Using the following code from

http://www.easyphp.org/presentation.php3

<html>
<head>
<title>My First page in PHP</title>
</head>
<body>

Current date : <? print (Date("l F d, Y")); ?>

</body>
</html>

My browser output is

Current date :

Thus, the php date stuff is not printing. Please advise.
Bondings
Is easyphp running? Also, you need to type http://localhost/date.php into your browser. If it outputs a blanco page, then something is wrong with apache, most likely it isn't working yet.
Tony The Tiger
Bondings wrote:
Is easyphp running? Also, you need to type http://localhost/date.php into your browser. If it outputs a blanco page, then something is wrong with apache, most likely it isn't working yet.


Does file:///C:/Program%20Files/EasyPHP1-8/www/date.php = http://localhost/date.php ?

The output is not blank. It is outputting the HTML fine. It is just the PHP part of the code that is a problem.

I.E., my output is

Current date :

instead of

Current date : Tuesday February 14, 2006
Tony The Tiger
I have easyPHP working now.
Related topics
php sessions
PHP: Feedback form issues.. help =P
Php and Other Wonderful Newbie Stories for Help.
php.ini
PHP - Reading Data
Wonders of the include() in PHP.
PHP Version
How to upload a file via html-form and php?
Where is the php.ini file?
PHP Read File Help needed.
A Question about the PHP.INI file.
Limiting php file functions with .htaccess
php tutorial problem
consistently get different script errors when logged in
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.