Web Server Tips
Having trouble getting CGIs working on your Linux Webserver? We hope these tips will help you address your concerns or at least direct you to some places for help!
with your webserver: 7 Tips for Newbies
Perhaps you've just downloaded a cool CGI program and are trying to get it working on your Linux Webserver, or simply having trouble with one you wrote. Here are things we've noticed tend to resolve almost all issues we've personally encountered.
1. If There's a Readme file Read It!
Carefully and thoroughly read the README that came with your CGI program. Lets face it, you will NOT be able to setup most cgi programs on your site unless you can read this patiently!
2. Edit Carefully Using these Tips.
Carefully edit the .cgi file and make sure not to forget to run the chmod command as described in README. When editing be very careful if you use the PICO editor since it does not handle long lines properly and often truncates lines creating errors! We recommend using a different text editor if you're doing major edits. Also, Do NOT change the first line #!/usr/bin/perl unless you know why you're doing it!
3. Fix any bugs that cause .cgi file to fail.
On more than one occasion I have seen CGI files with some bug or other. One example common bug is that somewhere there is a missing close parenthesis. Just make sure whenever there's an open ( there's also a close ) okay!
4. Test the cgi perl script by running command: perl search.cgi
5. Know your web directory location!
Often when the documentation refers to your web root directory or your www directory they actually mean the /home/httpd/ directory which is considered your web root directory. You can always use the locate httpd command to find out where on your particular web server this is.
6. Using tar files?
IF you also happen to be using a TAR file just note that the tar file may be stupid. Often a tar file when untarred is suppose to create a specific directory under your /home/httpd/cgi-bin but does not do so. Instead, you may want to create the correct directory yourself, otherwise you need to be careful to change the directories in the refering .cgi file and form.txt to include the appropriate directory. Does this 6th tip not make any sense to you? Please ignore it if you're not dealing with a tar file!
7. Always check the error_log for info if the .cgi is not working properly.Your log files for your web server would be located under the httpd directory so try to run locate httpd and see if something like /httpd/logs shows up.
After placing the appropriate files in the right directories you should be able to insert the form.txt directly into your .html page and see how it works.
Often CGIs taken off the web tend to be simple installations, so if youre really having problems, stop and check for simple things!
More Tips (Reallylinux site)
GREAT external Resources (other sites)
Need Extra Help