 |
Installing Your Own CGI Scripts
System Path Information
|
Item
|
Path
|
|
Sendmail
|
/usr/sbin/sendmail
|
|
Perl5
|
/usr/bin/perl
|
|
Date
|
/bin/date
|
|
Java
|
/usr/bin/java
|
|
Python
|
/usr/bin/python
|
|
Domain path
|
/home/[yourdomain.com]/www/
|
|
Cgi-bin
|
/www/[yourdomain.com]/cgi-bin/
|
System Environment Variable
If a script calls another file within your account, but the script does NOT require a URL, you need to use the system path. Instead of using the absolute path to your home directory, you should instead use the DOCUMENT_ROOT environment variable ($ENV{DOCUMENT_ROOT} in Perl) to determine the path of your files or programs within a script. For example:
Change this: /home/yourdomain/www/data/testing.cgi
To this: $ENV{DOCUMENT_ROOT}/data/testing.cgi
Calling CGI Scripts
Scripts Inside cgi-bin
When calling CGI scripts from a Web page, you must use the alias for the /cgi-bin/ directory. Any files placed in your /cgi-bin/ will be treated as executables and executed by the web server.
http://www.yourdomain.com/cgi-bin/perlfile.pl
Scripts Outside cgi-bin
You can put your CGI programs anywhere outside of the /cgi-bin directory. If you do, the program name must end in ".cgi".
http://www.yourdomain.com/perlfile.cgi
Scripts With Secure Server
To call a CGI script securely, the script must be placed in the /cgi-bin directory and the URL must reference your secure server (which is listed in Control Center). For example:
https://idXX.dnsprotect.net/[yourdomain.com]/cgi-bin/FormMail.pl
https://sslXX.dnsprotect.net/[yourdomain.com]/Count.cgi
Example Perl Script
The below perl script will print html with "Hello World !" as the title and "Hello World !" as the body.
#!/usr/bin/perl
print"Content-type: text/html\n\n";
#The html output
print "<html>\n";
print "<head><title>Hello World !</title></head>\n";
print "<body>\n";
print "<h2>Hello World !</h2>\n";
print "</body>\n";
print "</html>\n";
exit;
Back to Online Manual
|
 |
|