IST Computer Support Desk FAQ

Knowledgebase Home | Glossary | Favorites | Contact Knowledgebase Home | Glossary | Favorites | Contact
Search the Knowledgebase Browse by Category
Can I run CGI/PHP scripts under the University of Manitoba homepage server?
User Opinions (71 votes)
92% thumbs up 7% thumbs down

How would you rate this answer?
Helpful
Not helpful
Yes, you can run CGI/PHP scripts on the Home Page server ( http://home.cc.umanitoba.ca ) if you have an active Unix userid. Follow the steps below to set up the necessary support for scripts:
  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:

    http://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:
  • Every PHP page must contain: #!/usr/local/bin/php as the first line.
  • 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 Support desk 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/local/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>   Hello World!</i>\n";
    print "<b><br>      Hello World!</b>\n";
    print "</body></html>\n";

Visit the following link to see the result of the script running in the support account: http://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 the cgi-bin directory, will display "PHP rocks!" on a web page:

    #!/usr/local/bin/php

    <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: http://home.cc.umanitoba.ca/~support/cgi-bin/php_test.ph

More Information:

For more information about PHP on the home server you can visit: http://home.cc.umanitoba.ca/~support/cgi-bin/phpinfo.php


Related Questions
No related questions were found.
Attachments
No attachments were found.

Powered by ActiveKB Knowledgebase Software