PHP is a popular server-side, cross-platform, HTML-embeddable scripting language. PHP scripting from a College of Engineering user account should automatically be enabled. The files need to go into your public_html folder, and need to be owned by you (should always be the case unless you've altered permissions allowing others access).

1. To verify that PHP is working for you, save a file called 'test.php' to your public_html directory. 

2. Inside 'test.php' type the following lines:

<html>
<head>
<title>My first PHP script</title>
</head>
<body>

<?php
// the above "<?php" signals that the PHP script has begun
$today = date("Y-m-d");

print "Today is: $today.";
// the following "?>" closes the script 
?>
</body>
</html>

3. Save the file.

4. Launch your web browser and go to: (http://web.engr.oregonstate.edu/~your-username-here/test.php). If you have followed the above instructions carefully, the page you load should display the current date.

Some things to remember:

  1. Error reporting is off by default for the PHP cgi. To see error messages in your scripts, include the line <?php ini_set('display_errors', 'On'); ?> at the top of your script or page. Runtime directives for PHP have no effect when placed in .htaccess files under the cgi environment.
  2. PHP code must be within the PHP start (<?php) and end (?>) tags.
  3. Multi-line comments are enclosed within /* and */. Single-line comments can be made by placing a # or // at the beginning of the line.
  4. Statements that are to be outputted to the screen must be enclosed in double quotations ("), and prefaced by the PRINT statement.
  5. Almost every PHP command must end in a semi-colon (;).
  6. Any HTML commands placed within the print or echo statements will be interpreted by the browser, and perform their usual actions.
  7. Documents including PHP statements must be saved with the extension *.php (For example, myphpfile.php) by default. This tells the PHP interpreter to execute any commands found within the script. The extension can be adjusted by modifying the .htaccess file.

Links to resources for learning PHP can be found at php.net.

A particularly good beginners tutorial is over at W3Schools.