Home > Technical
Support > Web Support >Legacy Hosting >
Databases and Scripts
> Scripts > suEXEC
Requirements and limitations for UNIX CGI scripts using suEXEC
are as follows:
- Scripts must be placed in a subdirectory of your web site’s
document root directory. For example, a user with username "joeuser"
and a web site with the domain name “fooweb.com” would put his
script "test.pl" in:
/home/joeuser/fooweb.com/cgi/test.pl
Note that the “cgi” directory can be called anything
EXCEPT “cgi-bin.” (The directory name “cgi-bin” is used
for the other method of running scripts of DCANet’s servers, CGIWrap).
We recommend naming the directory, “cgi” or “scripts.”
- The cgi directory along with all the scripts in cgi, must
be world-executable. Use the command "chmod a+x filename" or "chmod
a+x directoryname" to set the execute-allow bit for all users.
- When FTP'ing Perl or shell scripts into your account, you
must FTP them in ASCII mode and not binary mode. When FTP'ing text files from
a DOS/Windows machine to Unix in binary mode, the MS-DOS end-of-line character
(^M) is left which will cause your script not to run in Unix. FTP'ing in ASCII
mode will strip these end-of-line characters for you.
- The DCANet Web Servers run BSDI BSD/OS as its operating
system, so any compiled executables must be for that architecture (Perl or
shell scripts will work regardless).
- The DCANet server will limit the CGI script to reasonable
levels of CPU and bandwidth use.
- All calls to user cgi programs are logged on the DCANet
web server.
Running your scripts
To run your cgi script, use the following syntax. We'll assume your username
is "joeuser", and your script is called "test.pl". Here's
a snippet of HTML code to show you how to invoke your script from an HTML document:
< a href="/cgi/test.pl">Run test.pl</a>
Similarly, you can invoke your script from an HTML form. We recommend always
using the POST method with HTML forms.
< form method=POST action="/cgi/test.pl">
On a final note, please be careful in writing your scripts
as it is possible to write a script which erases all the files in your account.
If you have doubts about the security of your script, have someone more knowledgable
about CGI and Unix security take a look at it.
|