Answered by the Webhosting Experts
Tags +
...

Managed Services
at Hivelocity

Bare Metal Shouldn’t be a Grind
Let Hivelocity take the busy work out of your daily server maintenance with our Managed Services plans. Choose from 1 of 6 different managed service offerings. Standard and Premium plans available.

Questions about something specific? Chat now with one of our expert account managers and learn which plan is right for you and your customers!

With Managed Server Technicians on-site 24/7/365, your server is always in good hands.

Tags +
...
Tags
...
...

How To Troubleshoot Your CGI Scripts – Internal Server Error 500

If you try to use a CGI script on your web page and you get an Internal Server Error 500, this means that the CGI script did not execute properly. There are several causes that can generate this error, so a few things will need to be checked. 

 

STEP 1: Check Permissions and Group Ownership

To start, you’ll want to check the /var/log/httpd/suexec_log. The log contains any errors that would result from not having correct permissions set on the file.

The file needs to be in a cgi-bin and must have the owner/group as the username who owns the site. If it’s owned be anyone else, it will not run. Also, the script must have execute permission.

The most common chmod permission is 755 (or rwxr-xr-x). You’ll need to go through all your directories from the public_html down to the directory the script is in, making sure that all permissions are set to 755 (*Note: public_html can be 750 *only* if it has a group of apache).

 

If Using a Hivelocity Server (Special Requirements)

If you’re one of our customers and you’re experiencing an Internal Server Error 500 on your CGI scripts, then it might be due to missing requirements specific to our servers. The Apache Server software that we run on our Hivelocity web servers has certain group ownership and permissions requirements for CGI scripts. Please check to see that your script meets the following requirements:

  • The directory the CGI script resides in must not be writable by other or by group users.
     
  • The CGI script itself must not be writable by other or by group users.
     
  • CGI script must not have the setuid bit set.
     
  • You must call SSI execs by their full pathname. For example, if you are running a UNIX command located on the web server it would look something like this:
     
    <!--#exec cmd="/usr/bin/date"-->

    If you are running a script that is in your pcgi-bin, it might look something like this for corp-web customers:
     
    <!--#exec cmd="/htdocs/youruserid/pcgi-bin/bar.pl"-->

    and like this for cheap-web and personal web customers:

    <!--#exec cmd="/htdocs/userdirs/youruserid/pcgi-bin/bar.pl"-->

  • The target userid may not be < 100 and the target gid may not be < 20. This rule only affects staffers’ CGI scripts. Staffers must chgrp their scripts to group users or some other group.
     
  • The minimum permissions for CGI scripts is mode 500. For CGI compiled programs, the minimum permissions is mode 100. You can of course grant more permissions if you wish. 
     
  • The minimum permissions for server-parsed-html (.shtml) files is mode 004 (readable by other), and exec files included therein must be at least mode 700 for scripts and mode 500 for binaries.

 

STEP 2: Troubleshooting your CGI Script

If you’ve checked the suexec_log and it only shows the script being run, then it might not be an issue with permissions. The cause of the error may be within the script code itself.

The easiest way to figure out script coding problems is to first run the script manually from an ssh prompt. You can do that using a variation of the following commands:

cd /home/username/domains/domain.com/public_html/cgi-bin

./script.cgi

One common error is the use of an incorrect interpreter. The two most common interpreters are:

#!/usr/bin/perl

and

#!/usr/local/bin/php

This code must appear on the first line of the script.

Sometimes, a file is uploaded in Windows format causing the trailing newline (return) character to form incorrectly. In this instance, the file would need to be re-uploaded in a different format.

Another error that could be generated when running the script manually from ssh would be missing perl modules. If you’re missing perl modules, you’ll need to install them manually. Using CPAN (The Comprehensive Perl Archive Network) is the easiest method to install new perl modules. This can be done with the following command:

eg: perl -e shell -MCPAN install Bundle::DBD::mysql

 

Popular Links

Looking for more information on CGI Scripts? Search our Knowledge Base!

Interested in more articles about Coding? Navigate to our Categories page using the bar on the left or check out these popular articles:

Popular tags within this category include: CGI Scripts, Zend Optimizer, PIP, Python, and more. 

Don’t see what you’re looking for? Use the search bar at the top to search our entire Knowledge Base.

 

The Hivelocity Difference

Seeking a better Dedicated Server solution? In the market for Private Cloud or Colocation services? Check out Hivelocity’s extensive list of products for great deals and offers.

With best-in-class customer service, affordable pricing, a wide-range of fully-customizable options, and a network like no other, Hivelocity is the hosting solution you’ve been waiting for.

Unsure which of our services is best for your particular needs? Call or live chat with one of our sales agents today and see the difference Hivelocity can make for you.

Share

Facebook
Twitter
LinkedIn
Email
WhatsApp

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your my.hivelocity.net account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your my.hivelocity.net account or if you are on the go, please reach out from your valid my.hivelocity.net account email to us here at: [email protected] We are also available to you through our phone and live chat system 24/7/365.

Rapid Restore

Backup your entire server’s data every night and have access to 5 days of rolling restore points.  Restore your server’s data, OS and configuration any time you need it.

Our Rapid Restore service saves the day during accidental data loss, hardware failures and virus contraction. Simply pick your recovery point and restore the data from that day. 

DDoS Protection

While our competitors may advertise DDoS protection, most often, they are merely implementing easily evaded router rules or simply black-holing targeted servers. They consider this “DDoS protecting their network.” However, neither of these solutions should give comfort to any online business. Should your site be attacked, chances are likely both of these options will end with your server being taken offline. At Hivelocity, we take the responsibility of keeping your servers online very seriously. For this reason, we offer two very serious forms of DDoS protection.

FREE

Every solution we provide includes our Filtering Edge of Network System (FENS). FENS is a series of proprietary systems that proactively monitors and protects the entire Hivelocity Network from most common Denial of Service (DOS) and Distributed Denial of Service (DDoS) attacks.

$15/MONTH PER SERVER

For an extra fee, you can enhance your server’s protection further with the addition of our Server Defense System. Our Server Defense System sits in front of your server, inspecting inbound data and looking for malicious traffic. The moment an attack is detected, it instantly begins scrubbing each data packet. Hivelocity’s Server Defense System delivers business continuity even in the face of massive and complex attacks.

Our Server Defense System is like adding an alarm and armed guard to your business, alerting you to and destroying anything attempting to jump that fence. Our Server Defense System utilizes internally developed proprietary systems in addition to Corero’s Threat Defense Smartwalls for data packet scrubbing. Each of our data centers is a scrubbing center with Corero Smartwalls on-premise, allowing us to provide on-prem zero-lag data scrubbing.

SSL Certificates

The security of your online commerce and protecting your customers’ data is as important to us as it is to you. When your customers see the green bar, they will know their connection to you is protected. We offer single domain, multi-domain, and wild-card certificates.

We offer industry leading 128-bit encryption certificates, allowing you to conduct e-commerce with complete security. Inspire confidence in your customers by displaying any number of seals and indicators certifying that your site is secure.

Load Balancing

Adding this service to two servers with identical content will allow you to distribute your load evenly across your hardware. Don’t lose business because you couldn’t handle the demand. Load balance and handle your biggest resource spikes with ease.

Firewalls

Stop attacks, prevent unauthorized access, and achieve regulatory compliance. Our Juniper hardware firewalls offload the work so your server never has to consume resources protecting itself from malicious traffic. A single firewall can be used to protect multiple servers.

Cloud Storage

Cloud storage offers users redundancy and easy accessibility, ensuring your data remains secure and readily available. Scale to as much as you need for only a 20¢/GB.

Cloud Storage is distributed and replicated across many servers, protecting your data from hardware failure. Highly scalable, it can handle thousands of client connections via TCP/IP. Connect to your virtual drive with SFTP, FTP, and SSHMount and in the future NFS and AFP. Cloud Storage is based on a stackable design which is upgradeable up to 2TB per instance.