Yes, you can run CGI/PHP scripts on the Home Page server if you have an active Unix userid. Follow the steps below to set up the necessary support for scripts.
PHP scripts can be run from anywhere within your public_html directory.
CGI scripts (perl, bash, sh, etc) can be run by following the procedure here:
1. Create a cgi-bin directory within your public_html directory (for instructions on setting up your public_html directory, visit http://home.cc.umanitoba.ca).
2. Put your CGI/PHP script into the cgi-bin directory.
3. Set the proper access permissions on the script and the directory by typing this command from within the public_html directory:
hostname% makepublic cgi-bin
Your script can be accessed by using the following URL format:
Every file in the cgi-bin directory must be set to be executable. This can be done by doing a chmod 755 on each file you create.
* There are no global variables. To access information submitted to a script you have to use predefined variables such as HTTP_GET_VARS and HTTP_POST_VARS.
* Every Perl CGI page must contain: #!/usr/local/bin/perl as the first line.
* The IST Help & Solutions Centre does not support/troubleshoot CGI or PHP scripts but if you are having trouble we will try our best to help.
You may wish to use a test script to ensure that everything is working properly.
The following perl script, when entered into a file called hello_world.pl and placed into the cgi-bin directory, will display "Hello World!" on a web page:
print "Content-Type: text/html\n\n";
print "<html>\n<head>\n<title>Hello World</title>\n</head>\n";
print "<body><center><h1>HELLO WORLD!</h1></center>\n";
print "<p>Hello World!\n";
print "<i><br> Hello World!</i>\n";
print "<b><br> Hello World!</b>\n";
Visit the following link to see the result of the script running in the support account:
The following PHP script, when entered into a file called php_test.php and placed into your public_html directory, will display "PHP rocks!" on a web page:
print "PHP rocks!";