www.  
Frequently Asked Questions
Tutorials
AIHOST Forums
Contact AIHOST Support

 

PHP Tutorial

How do I create a PHP document?
First you will need to make sure you have the following installed on your computer or have FTP access to: a web server (Apache) and php4. All PHP files are simple plain text (ASCII) files. This means that PHP scripts can be created no matter what Operating System you are running (UNIX, Windows, Mac...). There are several PHP GUI interfaces available, however this Tutorial does not suggest any particular one.

The most important parts of a PHP script are 1.) the processor instruction tags, and 2.) the path to the PHP parser. The processor tags are <? to begin a PHP statement, and ?> to end a PHP statement.

A text editor is open… now what?
PHP scripts can be created right inside of an HTML page. Our first example will be named hello_world.php3. (NOTE:The file name can be whatever you wish. This is an arbitrary name.) Type the following data into your hello_world.php3 file.

<html>
<head>
<title>Hello World</title>
</head>
<body>
<? #!/usr/local/bin/php
echo "Hello World!";?>
</body>
</html>

Save this file and upload it to your Virtual Server Account, The PHP script must be browsable. The file should be parsed.

Commenting in PHP
Commenting is used to hide code or to write a comment about the code. To comment use "//" at the beginning of the text to be commented out. An example is shown below:

<html>
<head>
<title>Hello World</title>
</head>
<body>
<? //The following line of code is used to determine what kind of browser being used.
&#!/usr/local/bin/php
echo "Hello World!";
echo $HTTP_USER_AGENT;
?>
</body>
</html>
 
   

 
Online Forums  ::   Services ::   About Us  ::   Support  ::    Contact Us  ::    Login  ::    Home  
AIHOST.NET™ 2006. All rights Reserved, Powered By TelNex Technologies, Inc.