Page Index Toggle Pages: 1 Print
500 Internal Server Error (Read 10739 times)
Captain John
Ex Member


500 Internal Server Error
Sep 25th, 2007 at 2:50am
Print Post  
How Do I Get More Specific 500 Errors?

This trick causes the web server do display more information about why a 500 error occured. Note that some servers do not support this technique, so it is not guaranteed to work, but it work do work on most servers. Note that if it didn't work, you'll need to remove the code again immediately, because if the server is missing the module requiered for this to work, this line will cause a 500 error all by itself, blocking other troubleshooting attempts. This trick can be added to any of your exacutable YaBB files (Setup.pl, YaBB.pl and AdminIndex.pl). Make sure you add it to the file you are currently trying to run, it doesn't make sense adding it to YaBB.pl if the problem occurs while running Setup.pl. All you have to do is to add the code below to the top of the file in question, right below the path to perl line:

Code
Select All
use CGI::Carp qw(fatalsToBrowser); 



Note: in versions of YaBB newer than Y2.3.1, this is already in YaBB.pl, Setup.pl and AdminIndex.pl
Code
Select All
# use CGI::Carp qw(fatalsToBrowser); # used only for tests 


Simply remove the "#" to enable it

Note that it is vital that you type this line absolutely correct when adding it to your file. This line is perl code, which mean it is case and syntax sensitive. Any mistake, and the line will generate a 500-error all of its own, instead of helping you resolve existing ones. Also note that this line relies on a server module that not all server has (Most though). If adding this doesn't seem to make any difference for you, please remove this line again, to avoid the possibility of this line causing an error in itself...


Why Am I Getting A 500 Error?

Check the following:

   * Did you upload the scripts in ASCII?

Note that if you didn't upload the files at all (By downloading directly to the server), or you uploaded the zip file to the server and unzipped it locally there, you either need to make sure that you unzip it with the correct parameters, or you will end up with DOS-style linebreaks on the files. The correct parameters will vary between utilities, so check the manual for yours. An alternative way is to run a utility called dos2unix on the files after extracting, as this will convert them. Note that this issue is only related to unix/linux servers.

   * Did you set CHMods correct? (Most importantly, the YaBB.pl, AdminIndex.pl and Setup.pl files, and the 'yabb2' directory must all be CHMOD 755. Enything else, including 777, as a high probability of causing a 500 error)
   * Did you set Perl-path correct? (in first line of your script i.e. "#!/usr/bin/perl")
   * Did you use the right paths?
   * Does your server support Perl scripts ?
   * Check the values in your Settings.pl! The "$use_flock" setting is especially important. Set it to 1 for a server running on Unix/Linux, Macintosh or WinNT platforms. Set it to 2 for a server running on a Windows 95, 98, or M.E. platform.
    * Is your Perl version lower than 5.6?
The 'our' function is available only since Perl v5.6.0
Edit setup.pl
Code
Select All
 # If your Perl version is lower, then comment the 'our'-lines out and use this:
# use vars qw(@categoryorder,@catboards,@catdata,@boarddata,@allboards,%catinfo,%cat,%board,%boarddata,$catfile,$boardfile,$key,$value,$cnt);
our (@categoryorder, @catboards, @catdata, @boarddata, @allboards);
our (%catinfo, %cat, %board, %boarddata);
our ($catfile, $boardfile, $key, $value, $cnt);
our (%fixed_users); 



Remember that each of the steps above can generate a 500-error on it's own, so it is important to make sure everything is correct at the same time.

If you have checked all of the above and you are still getting a 500 ISE error, try adding "--" (without quotes) after your path to perl in YaBB.pl, AdminIndex.pl and Setup.pl.


If you STILL get a 500 error, it's one of the following:

   * Incorrect path to Perl (also known as shebang)
   * Incorrect file permissions (chmodding)
   * Incorrect format when uploading (ASCII/Binary)
   * Incorrect filename or path when calling the script
   * Inability to run perl scripts (Not allowed at all, not allowed in this directory, etc)


If you still get a 500-error, and no more information after adding this line, it is usually one of the reasons given below. Note that if your script is already running, but the 500-error occurs somewhere in the middle (Like in the middle of the converter process of Setup.pl) only the first two items in the list is valid, and you can ignore the rest. If the script doesn't run at all, all items are valid. Remember to differensiate between the files. If Setup.pl ran fine, but YaBB.pl never started, most items in the list could be the potential problem.

   * The server doesn't support the module required. Remove the code immediately
   * The CHMOD's are not correct. Make sure the file in question is CHMOD 755, and the directory it resides in are 755 as well. Your host may have some special restrictions when it comes to CHMODs as well, especially the one for the three executable files and the 'yabb2' directory itself.
   * The path to perl line isn't correct. Make sure it begins with the #!-characters (No matter what info your host has given you. Many gives you just the path, and those two characters are not part of the path, just vital identifiers in a script file), and that the path that follows is 100% correct. Alo, do NOT add any switches at the end of this line, like -w, -T or the like. The only one that should appear at the end is the -- one that is in there by default. (Again, ignore what your host says about this matter. Many lists -w at the end of the path to perl for some reason)
   * File was uploaded in Binary mode instead of ASCII mode. Reupload the file in forced ASCII mode (Avoid the Auto/Smart mode of your FTP client). If you have command line access to the server(Console, SHH, Telnet), and it is a unix/linux box, you can also run dos2unix on the file, but remember to CHMOD it again afterwards if you do.
   * You are not allowed to run cgi scripts, either at all, in this directory, or with this extension. Check with your host if you are allowed to run cgi-scripts, and exactly where on the server you need to place these. You can also try renaming the three executable files (YaBB.pl, AdminIndex.pl, Setup.pl) from .pl to .cgi (YaBB.cgi, AdminIndex.cgi, Setup.cgi). Make sure you rename all three of them if you do, and do NOT rename any of the other .pl files in the package.

edited by JonB - 2009-01-02 to include 'our' info
« Last Edit: Jan 2nd, 2010 at 6:12pm by »  
Back to top
 
IP Logged
 
Captain John
Ex Member


Re: 500 Internal Server Error
Reply #1 - Dec 8th, 2008 at 5:47pm
Print Post  
Y2.3 500 ISE when Posting ...

If your getting ...
[Sun Oct 19 17:31:46 2008] YaBB.pl: Can't continue after import errors at Modules/Upload/CGI.pm line 27
[Sun Oct 19 17:31:46 2008] YaBB.pl: BEGIN failed--compilation aborted at Modules/Upload/CGI.pm line 27.

type errors .. it is usually because your Host Server has not updated the Perl Modules ...

ebcdic2ascii is an Apache-specific function which is available only on EBCDIC based operating systems (OS/390, BS2000). It translates the EBCDIC encoded string ebcdic_str to its equivalent ASCII representation (binary safe), and returns the result.

ascii2ebcdic is the inverse of ebcdic2ascii.

A Work around is to, If it makes problems remove it. I think everything will work as intended anyway.

change line 27 from...

Code
Select All
use CGI::Util qw(rearrange make_attributes unescape escape expires ebcdic2ascii ascii2ebcdic); 



to...

Code
Select All
use CGI::Util qw(rearrange make_attributes unescape escape expires); 



i.e. remove "ebcdic2ascii" and "ascii2ebcdic" from line 27 in Modules/Upload/CGI.pm.
  
Back to top
 
IP Logged
 
Captain John
Ex Member


Re: 500 Internal Server Error
Reply #2 - Nov 10th, 2010 at 5:48pm
Print Post  
Additional troubleshooting ..........

Perl by default is very forgiving. In order to make it more robust it is recommended to start YaBB & AdminIndex.pl program with the following lines:

   1. #!/usr/bin/perl
   2. use strict;
   3. use warnings;

The two additional lines request from perl to catch various common problems in your code. They check different things so you need both. A potential problem caught by use strict; will cause your code to stop immediately when it is encountered, while use warnings; will merely give a warning (like the command-line switch -w) and let your code run.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Print
 
  « Board Index ‹ Board  ^Top