Webhosting Perl and CGI Scripts: Difference between revisions
(Created page with "link=:Category:Webhosting You can upload any perl scripts to anywhere on your web site. You can make a cgi-bin directory if you like, but scripts can be in...") |
No edit summary |
||
Line 22: | Line 22: | ||
|- |
|- |
||
| PATH_INFO |
| PATH_INFO |
||
| If after the script there is a / and more |
| If after the script there is a / and more of a path then this is that path |
||
of a path then this is that path |
|||
|- |
|- |
||
| PARAMS |
| PARAMS |
||
Line 35: | Line 34: | ||
|- |
|- |
||
| HTTP_HOST |
| HTTP_HOST |
||
| Host: header contents |
| Host: header contents Your web site name |
||
Your web site name |
|||
|- |
|- |
||
| HTTP_AGENT |
| HTTP_AGENT |
||
| User-Agent: header contents |
| User-Agent: header contents The browser being used |
||
The browser being used |
|||
|- |
|- |
||
| CONTENT_TYPE |
| CONTENT_TYPE |
||
| Content-type: header contents |
| Content-type: header contents Used for form postings |
||
Used for form postings |
|||
|- |
|- |
||
| CONTENT_LENGTH |
| CONTENT_LENGTH |
||
| Content-length: header contents |
| Content-length: header contents Number of bytes in PUT file |
||
Number of bytes in PUT file |
|||
|- |
|- |
||
| SCRIPT_NAME |
| SCRIPT_NAME |
||
Line 60: | Line 55: | ||
|- |
|- |
||
| HTTP_REFERER |
| HTTP_REFERER |
||
| Referer: header contents |
| Referer: header contents The page this link came from |
||
The page this link came from |
|||
|- |
|- |
||
| REMOTE_USER |
| REMOTE_USER |
||
| If a login was required, this is set to |
| If a login was required, this is set to theuser name |
||
user name |
|||
|- |
|- |
||
| valign="top" | REMOTE_ADDR |
| valign="top" | REMOTE_ADDR |
||
| valign="top" | The remote IP address. |
| valign="top" | The remote IP address.This could be an IP6 or IP4 address. |
||
This could be an IP6 or IP4 address. |
|||
|} |
|} |
||
Revision as of 07:51, 25 July 2013
You can upload any perl scripts to anywhere on your web site. You can make a cgi-bin directory if you like, but scripts can be included anywhere on your web site.
For perl, the script should start with #!/usr/bin/perl
Particularly for perl scripts uploaded from windows machines, please upload in ASCII mode not BINARY.
Within the script, the mail program used for sending mail is /usr/lib/sendmail . You should not use this with the -t argument (which find the From and To in the email) but use -f 'from-email-address' 'to-email-address' in place of the -t argument.
A simple mailer is available - see below.
There are various perl scripts available on the internet, and many books on the subject. You do not have access to php or mysql on the server, and you may have to change the use of sendmail as above.
Your scripts have access to the following environment variables :-
QUERY_STRING | The query string (bit after the ? in the
URI) |
PATH_INFO | If after the script there is a / and more of a path then this is that path |
PARAMS | The parameters (bit after a ; in the URI) |
REQUEST_METHOD | PUT or GET |
REQUEST_URI | The URI (web page) requested |
HTTP_HOST | Host: header contents Your web site name |
HTTP_AGENT | User-Agent: header contents The browser being used |
CONTENT_TYPE | Content-type: header contents Used for form postings |
CONTENT_LENGTH | Content-length: header contents Number of bytes in PUT file |
SCRIPT_NAME | The name of the script being run |
HTTP_COOKIE | Cookie: header contents |
HTTP_FROM | From: header contents |
HTTP_REFERER | Referer: header contents The page this link came from |
REMOTE_USER | If a login was required, this is set to theuser name |
REMOTE_ADDR | The remote IP address.This could be an IP6 or IP4 address. |
Other Webhosting pages:
<ncl style=bullet maxdepth=5 headings=bullet headstart=2 showcats=1 showarts=1>Category:Webhosting</ncl>