Whenever possible place any executable scripts inside the cgi-bin directory.
When uploading scripts via FTP make sure to always use ASCII mode. If you are doing a server to server FTP transfer use BINARY mode.
The first line in all PERL scripts must contain the path to PERL which is: #!/usr/bin/perl
Directories and scripts should both executable. Usually the permission level 755 is the best. All files and directories where CGI will be executed must NOT be world or group writeable and must be at least user executable.
Data files that scripts will read/write must NOT be group or world writeable.
Make sure that you DO NOT modify the permissions of the cgi-bin itself. This will cause all scripts to fail. If the permissions have be altered, chmod the cgi-bin back to 755.
Check the code. Frequently there may be a line not closed with “;” or a routine that is not closed.
Make sure that all modules and ‘include files’ required by the scripts are located on the server and are in the proper locations.
Check that your CGI/Perl script is outputting the necessary HTTP headers. To do that in Perl, just below the “shebang” line (#!/usr/bin/perl), type the following line.
#!/usr/bin/perl
print "Content-type: text/html\n\n"
Add a “-w” to the first line of your script. (Example: # !/usr/bin/perl
Most FTP programs allow you to change the permissions of files on the server. You may also use the command shell (SSH) and use the command directly. Example: chmod 755 myscript.cgi
Leave a Reply
You must be logged in to post a comment.