# 500 Internal Server Error

### ...and how to fix it.

When running a Perl CGI script like FileChucker or UserBase, you may see the "Internal Server Error" message in your browser.  The message will usually also say something like "please check the server's error-log for more information."  You should do that -- the message printed to the error log will often tell you exactly what the problem is.  The Apache error log, for example, is often located at /var/log/apache/error_log or /var/log/apache2/error_log (or sometimes "error.log").

If you don't have access to the error log, the next simplest thing to do is to make a copy of the script, then open the original and delete all of its contents, and add just these 3 lines to the file:

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "testing...\n";


(Note: if the server is a Windows system, then replace the first line above with either #!perl or #!c:\path\to\perl.exe.)

Now try to access the page in your browser again.  If it works (you see "testing..." as its output) then you know that your server is at least configured properly for running Perl CGI scripts.  If it doesn't work, then that may mean the problem is in the server configuration, rather than with your CGI script.  (For example, are you sure you actually have Perl installed?  Virtually all UNIX/Linux/OS X servers do, but Windows servers usually need to have it installed manually, from a free package like ActivePerl.)

Assuming your server is configured properly for running CGI scripts, your problem may be one of these common causes for the Internal Server Error:

### Problems outside the script:

1. Directory permissions: your cgi-bin directory should be chmodded as 0755, not 0777.  Similarly if your script is at .../cgi-bin/foo/bar.cgi, the foo directory must not be world-writable (0777).  This is because many servers will refuse to execute CGI scripts within world-writable directories, as a security precaution.
2. File permissions: your CGI script itself must also be 0755 and not 0777, for the same reasons.
3. Transfer modes: if you are using FTP to transfer the CGI script to your server, then your FTP client is probably set to AUTO transfer mode; that is, it will try to figure out whether to use BINARY or ASCII mode without asking you.  But depending on whether your CGI script came from a Windows or UNIX system, and whether it's going to a Windows or UNIX system, you may need to manually set your FTP client to use either ASCII or BINARY mode before transferring your CGI script.  Try one and then the other.
4. Line endings: the cause of the transfer-mode problem is actually another problem in itself: different types of Operating Systems (namely, Windows vs. UNIX/Linux/everything) use different character codes to represent line-endings.  If your server is a UNIX server, but you're editing your CGI script on a Windows computer with a text-editor that doesn't use UNIX-style line-endings, it'll cause problems.  Applications like GoLive and Dreamweaver sometimes get this wrong.  Even built-in editors can't agree: WordPad (not Word) seems to get it right while Notepad messes it up.  So try opening & saving your CGI script in a different text editor and uploading it to the server again.

### Problems within the script:

1. The shebang line: the first line of a CGI script must contain the path to the Perl binary on the server.  On most UNIX servers this is just #!/usr/bin/perl or sometimes #!/usr/local/bin/perl and you can always run the command "which perl" to find out for sure.  On Windows servers, you can sometimes get away with just using #!perl but you may need to specify the full path like #!c:\path\to\perl.exe.
2. Actual script errors: it's always possible that there's simply an error in the Perl code itself.  If you're having trouble with a script you purchased from Encodable Industries, this is unlikely since many other people have bought the same exact script and are running it just fine.

### Related Problems

1. Another common problem with CGI scripts is the premature end of script headers error.

# Client Quotes

The work, the thought and the organization you put into this app is incredible.
– Bruce C.
I looked all over trying to find a simple cgi script.  I found that FileChucker was by far the best.  If you have issues with your hosting service's php.ini max upload size then this is the way to go.  Looking forward to future enhancements.
– Bob C.
Nice script, it's saving the day on our project.
– Aaron W.
I just wanted to say that yours is the first product that I've tested so far that hasn't failed on handling uploads.  This is going to work for a print company, so they are handling nothing but large files and all the other solutions I've tried so far have not been reliable.  So far yours has been 100% successful in my tests.
– Kevin H.
I just installed the demo of your product and got it up and running in no time.  I searched high and low for a decent login script and thank God I found yours.
FileChucker is working great...  Clients love it.  Vendors love it.  We love it.
– Gerry W.
The amount of customization in the program is incredible.  I was able to integrate it into my existing page layout relatively simply.  I was also able to easily customize the look/feel to match the current site.
– Jason M.
Do you know how rare it is to have a "canned" shopping cart with the ability to fairly easily do complex pricing options on a single item?  Maybe you do, but if you don't... basically, they don't exist!  I have looked.  Everywhere!  And the few that might even come close to the functionality that you have in CornerStore cost a fortune!
– Tashina P.
Just one word: Fantastic.  10-minute job to plug FileChucker into my app, and it now works a treat.  It's through the hard work by people like yourselves that make my job so much easier.  Congratulations on an outstanding product... Many many thanks.
– Sean F.
Our members think your software is fantastic...  I would recommend your software and your company to anyone.  Thanks for all your help.  It has been a pleasure dealing with you.
– Tommy A.
FileChucker is helping drive the backend of several high profile entertainment sites for people like Shania Twain and Dolly Parton.  We're also using it to drive backend file uploads for a multi-billion dollar banking institution.  It's a great product.  We've tried other "chucking" upload solutions with progress bars using flash and php, but nothing works as reliably as FileChucker.
– Michael W.
Thanks again for a great product and great support - beyond expectations.
– Greg S.
FileChucker is a great drop-in solution for file uploads, and worth every penny of its very reasonable cost.  Encodable's support is excellent to boot.
– Loren A.
I just want to say you guys really stand alone in that you have a quality product and you provide genuine customer service.  It's sad but those qualities are seldom found separately, much less together.  Thanks again for your time and help.
– Alex S.
Thank you VERY much for all of your help.  You've really impressed me.  We have support agreements for other software that costs thousands of dollars / year (just for the support), and most of them aren't as helpful as you have been.
– Keith Y.