Troubleshooting CGI Scripting
I ran into something really touchy today. Look at the difference between these two scripts -- one of them works and the other doesn't.
#!/bin/perl
print("Content-type: text/html\n\n");
print("Hello, world!");
and
#!/bin/perl
print("Content-type: text/html\n\n");
print("Hello, world!");
Which one works? The second one because it has two line endings at the end of text/html. If you only put one line ending the script will fail.
If you don't put the shebang, #!/bin/perl, pointing to your perl executable, the script will fail.
Also, every CGI script should print the content type header before anything else is printed.
print("Content-type: text/html\n\n");
That let's everyone know the output is html (meaning your machines).
[Click to add or edit comments])
Please prepend comments below including a date