Can I run CGI/PHP scripts on the Home Page Server

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 https://home.cc.umanitoba.ca/setup.html).
  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:
https://home.cc.umanitoba.ca/~userid/cgi-bin/scriptname

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.
Please note:

  • 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/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:

#!/usr/bin/perl
use CGI;
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>&nbsp;&nbsp;&nbsp;Hello World!</i>\n";
print "<b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hello World!</b>\n";

print "</body></html>\n";

Visit the following link to see the result of the script running in the support account:
https://home.cc.umanitoba.ca/~support/cgi-bin/hello_world.pl

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:

<html>
<head>
<title>PHP ROCKS!</title>
</head>
<body>

<?php
  print "PHP rocks!";
?>
</body>
</html>

Visit the following link to see the result of the script running in the support account:
https://home.cc.umanitoba.ca/~support/cgi-bin/php_test.php


Help & Solutions Centre
204-474-8600 
123 Fletcher Argue
 
Bannatyne Help Desk
204-789-3541
230 NJM Library