CGI/PHP Scripts

CGI Scripts

The department web server does support the use of CGI Scripts, and these can be written in any language. The only requirements are that the filename ends in .cgi in order to be recognized by the server as a valid CGI script, and if you're using a compiled language (C, for instance), that it be compiled on our cycles machines. Our web servers all run Linux.

We ask that you take care in writing your script so that it doesn't consume excessive resources on the web server. If it writes temp files, please make sure it cleans up after itself. In the event of a runaway process, we will attempt to contact you first, but if load on the server is critical and we don't get a response, the running script will be killed, and, if the situation warrants, the script will be disabled until we hear from you.

If you know in advance that your script requires (or might require) more resources, please let CS Staff know, and we can make special arrangements for you.

Please also take care in writing your scripts with regards to security. Please keep security in mind during the writing of your script to avoid exposing directories that might allow files to be placed on the server, exposure of system files or information, or other such unintended effects.

Script Problems

If you are experiencing problems with your CGI script make sure that the script's file name ends in .cgi: these are the only files the web server will recognize as valid CGIs.

If you are having problems with your CGI script returning a server error you can contact CS Staff for details of the error. For security-related reasons we don't allow direct user access to the server logs.

PHP Support

The department web servers support PHP and since it is heavily used on the main web site, it is kept up to date. All that is required to use PHP is to create a file ending in .php that the web server can access. The official language documentation is located here [php.net], and a good "getting started" guide can be found on the same site here.

There is a CLI version of PHP available in /usr/bin on the public login servers, which is the same version as the web server. You can run "/usr/bin/php --info" to see what's available. We don't encourage its use - especially in a web context - but it's there if you need it.

Writing Web Applications

When planning a website that may be more than just publicly-available information, there are some additional resources, best practices and University guidelines that you should be aware of. These include things such as the availability of a database server, and using CAS for authentication.

Database Access

We provide a database server running MySQL on which users can have databases, either a single personal database, or a collaborative database tied to a project. You can request a database using the form here.

Authentication

It is a University policy that all projects requiring authentication use the Central Authentication Service (CAS) protocol. This allows you not to have to worry about dealing with authentication directly, and allows your users not to have to worry about what your site is doing with their authentication credentials. Both OIT and CS run CAS servers, so you can choose the one that best suits the access you require for your application. More information on CAS can be found on this page.

Tags: