abc1234.
Step 1.
Create a subdirectory of your abc1234
home directory named public_html.
Make sure that it has an underscore, not a dash.
Chmod
the public_html directory to have the permissions
rwxr-xr-x using the command
chmod a+rx public_html
Step 2.
Create a file named index.html in your
public_html subdirectory.
This will be your default WWW home page on acf5.
Chmod
the index.html file to have the permissions
rw-r--r-- using the command
chmod a+r index.html
The WWW URL of your home page is now
http://acf5.nyu.edu/~abc1234
public_html directory named cgi-bin.
Note that "cgi-bin" has a dash, while
"public_html" has an underscore.
Chmod
the cgi-bin directory to have the permissions
rwxr-xr-x using the command
chmod a+rx cgi-bin
Step 4. Create a perl program in your cgi-bin directory. The program must:
Content-type: text/html"
on the first line and a completely blank line as the second line.
(Both lines are terminated by \n).
Let's say you create hello.pl. It might look like this:
#!/usr/bin/perl -w # Output required CGI header print "Content-type: text/html\n\n"; # Output text of my simple web page print <<END_HTML; <html> <title>Hello world</title> <body> <h1>Hello, world</h1> </body></html> END_HTML exit;
./hello.pl.
If if produces the header line Content-type: text/html,
followed by a blank line, followed by your HTML output,
then you are in good shape.
If it does not execute, gets an error from perl,
or does not produce the expected output,
then you will need to review the above steps until your
hello.pl CGI runs from the shell.
If your perl CGI does not run from the command line,
it will not run as a CGI web page.
It is much easier to debug problems when working form the command line
than when you try to run it from a web browser.
Step 6. Next, execute your perl script from a web browser. Enter this URL into your browser:
http://acf5.nyu.edu/cgi-bin/cgiwrap/~abc1234/hello.pl
If it does not run, go back to Step 5.
Step 7.
Finally, put the following sentence in your
index.html file:
Click <a href = "http://acf5.nyu.edu/cgi-bin/cgiwrap/~abc1234/hello.pl">here</a> to run my Hello Perl CGI.