Creating a webpage using PHP is very simple. PHP-enabled pages can be created and edited
the same way as your regular HTML pages but you will save your file as a .php
file rather than an .html file. The following steps need to be done before you can create
a webpage in our environment. This tutorial also explains the creation of a simple PHP page.
You will need to be familiar with basic UNIX commands in order to understand the following
instructions. If not, take a look at the manual pages for the following commands:
ls, mkdir, chmod. Use the "man" command to read a man page.
If you have already set up a homepage as index.html, you can just rename it index.php. Otherwise
use any text editor to create your PHP code. Please note that the file you create should be in
the .www directory with the .php extension.
Cut and paste the following into the editor:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>PHP Test</title>
</head>
<body>
<?php
echo '<p>Hello World</p>';
?>
<p>
The views and opinions expressed in this page are
strictly those of the page author. The contents
of this page have not been reviewed or approved
by the University of Minnesota.
</p>
</body>
</html>
Save your file as index.php. Then, from your .www directory,
execute the following command to ensure that the file permissions are correct.
% chmod 644 index.php
This will make your page viewable to users with a web browser.
Use your web browser to access the file. The URL for your script should be:
http://www-users.cs.umn.edu/~<username>/index.php
http://www-users.itlabs.umn.edu/~<username>/index.php
If you get an Internal Server Error, double-check that you followed all the steps above. If you still can't
get it to work, contact Systems Staff.