PHP Web Hosting
The following basic steps are intended to help you create your first php page using the campus php server.

1. Create a directory called dynamic_php in your home directory.
2. Create a php file inside of this directory.
3. Set the permissions properly.
4. Use a web browser to connect to your page.

1. Create a directory called dynamic_php in your home directory.

Each user at Radford University is provided with file/disk space on a campus server. This directory is typically available as drive letter H: when you log into a University owned computer. You can also access this drive by mapping a connection to \\home\USERNAME where USERNAME is your RU username. The document "Mapping a Network Drive" provides detailed instructions on mapping a network drive.

After you have mapped to your home directory you may create a new folder named dynamic_php in your home directory. This directory MUST be in the root directory of the mapped network drive, not within the public_html directory or under any other folder.

If you are familiar with Unix and wish to do this from a Unix command prompt on one of the campus Unix servers (ruacad.radford.edu or rucs.radford.edu) you may execute the following command.

If you have a directory called dynamic_php located in your file space then the RU PHP server will be able to serve these pages.
NOTE: This is a separate / different directory from your normal public_html directory.

2. Create a php file inside of this directory.

Any file that has an extension ending in .php will be treated as a php php script and executed on the server.
After you have created the dynamic_php directory you are ready to create your first PHP document. Any file with an extension of php will be seen as a php document. If you name a file index.php it will automatically be loaded as the default page if someone connects to https://php.radford.edu/~username


A sample php file (index.php)


<html>

<head>
<title>My First PHP Page </title>
</head>

<body>

    <?
       # Beginning of PHP code Block
       $HelloString="Hello World ";
       $CurrentTime=date("h:i:s a");
       print $HelloString . $CurrentTime;
       print "<br>";
    ?>

</body>

</html>


3. Set the permissions on files and directories properly.

In order to make setting permissions as easy as possible a UNIX program is available to automatically set the correct permissions on all of your files.
We have also included detailed instructions on properly setting the file permissions from the command line. If you are going to use the php-permissions.sh program listed above to set these permissions then you can skip to Step 4.

PHP scripts are executed using a program called cgiwrap. This keeps PHP programs secure by executing them under your own userid and group instead of the user that the web server is running as. This allows you to change the permissions on all php programs to 700 (read write only by the owner) to lock out other users on the server from being able to view your source code. This is extermely important if you are including a password to your mysql datatabse in your php code.
The permissions on any directory (including your dynamic_php directory) must be set to 711 (read,write,execute by the owner and execute by group and other) for your php programs to run properly. If you include graphic files (.gif or .jpg) or regular html files (.html) in your directory these files will need to be set to 644 (readable by everyone and writeable by the owner).

4.
Use a web browser to connect to your page.

The php.radford.edu web server is running with SSL encryption, so you will need to be sure you include the s in https://
The generic format of the url to access your web pages will be: