June 29, 2006

CGI queries and their solutions.

by @ 1:36 pm. Filed under Perl Tutorials

For some reasons I cannot execute and run my CGI/Perl script. Why do I get a 500 Error Page?

Follow the following steps:

1. Make sure the Perl path is set to /usr/bin/Perl
2. Make sure the .cgi/.pl file was uploaded to cgi-bin folder
3. Make sure the .cgi/.pl file was uploaded in ASCII mode.
4. Make sure to CHMOD the script to 755.

If this does not works contact your web hosting company 24×7 technical support.

I edit my CGI script, and then it no longer functions. Why?

Perl CGI scripts must be uploaded to your account via FTP as ASCII files to run properly. Also, all CGI hosting scripts must be executable. This requires setting the permissions on the file using your FTP hosting program and making sure the script is world executable (CHMOD).

If you are getting an “Internal Server Error” and you have verified the CGI script was uploaded as an ASCII file and it is executable, there may be a syntax error in the code. The easiest way to determine this is to telnet into your web site hosting account, go to the directory that contains the script (cd www/directory), and run the program from the prompt by typing in the name of the script. This will show the error in the program.

Why is it that my CGI script will not write to a file on the dedicated server?

All CGI scripts that are called from the web do not run with your account’s permission by default. This is for security reasons. The CGI scripts run as the user ‘nobody’, which is a fake username with no permissions. Because of this, any file or directory that you want a script to write to must be world writeable (CHMOD 777). This includes files such as .rdb, .dat, .txt etc.

One Response to “CGI queries and their solutions.”

  1. Jason Says:

    Hello,

    You can also troubleshoot the problem by looking at the error logs of apache.
    If its a premature end of script headers then simply fire following command and that may fix your problem.
    cp -p yourscript.cgi yourscipt.cgi_BK
    dos2unix yourscript.cgi
    You can also troubleshoot it more by executing that script from the shell.
    e.g.
    ./yourscript.cgi
    Hope that will solve your problem.
    Enjoy..

Leave a Reply

You must be logged in to post a comment.

RESELLER HOSTING | DEDICATED SERVER | PREMIUM HOSTING | VPS HOSTING

Micfo Hosting

Micfo International LLC Leading the hosting Industry with Cheap and Affordable Linux Web Hosting Packages.

internal links:

categories:

archives:

Services:

Micfo Hosting

Micfo, delivering the best cpanel web hosting with maximum reliability is our exclusive focus.
Micfo International LLC

search blog:

TOP 10 POSTS:

Pages:

General Links:

Syndicate

other:

33 queries. 0.102 seconds