Hosting Services > Developer's Corner > PHP

Conventions and Specific information

We currently have both PHP versions 5.0.3, 4.3.10 and 3.0.18.
The "CGI redirect" version of PHP is installed. PHP files should end with the extension
.php5, .php3 or .php to use the appropriate version of PHP.  PHP files should be placed with your web documents; not in your /cgi-bin directory.  GIF creation via PHP is supported and permitted.

For advanced users who wish to have different extensions handled as PHP scripts, this can be added to a .htaccess file.

AddType application/x-httpd-php4 .html
or
AddType application/x-httpd-php5 .htm

 

Sample code

A simple PHP program (hello.php3):

 
<?php echo "Hello World"; ?>


A more advanced PHP script with HTML embedded code (math.php3):

 
<html>
<head>
<title>PHP Test Script</title>
</head>
<body>
 
<b>A simple math problem...</b><br /><br />
 
<?php
$a = 5;
$b = 9;
echo "$a plus $b is equal to ",  $a + $b;
?><br /><br />
 
<b>PHP Counting to 10...</b><br /><br />
<?php
$n = 1;
while ($n <= 10)
{
echo "$n <br />";
$n++;
}
?>
</body>
 
</html>