CGI Scripts Won't run - Internal Server Error

I resent spun up a new server with CentOS and installed VirtualMin. I use this primarily for one website with a lot of data.
For the search I have a search.cgi script. Coming from the old server with an older version of CentOS and VirtualMin I imported the backup file and the main portion of the website was up and running.

Except for the Search. When the script is executed I recieve Internal Server Error.

On the error logs it says:

suexec failure: could not open log file
fopen: Permission denied
Premature end of script headers: search.cgi

suexec log shows:
uid: (501/USERNAME) gid: (501/USERNAME) cmd: search.cgi

Which from what I have researched this is showing that suexec is operating correctly

The cgi script is located in \home\USERNAME\cgi-bin\search\search.cgi
search.cgi - Permissions are 755
cgi-bin dir - 755
search dir - 755

Owner and group on search.cgi are USERNAME:USERNAME

I apologize in advance since it has been a few years since I set up a VMin server. I remember having to change “something” when I set up the previous server but am completely stuck now.

I am not familiar with perl but did create a “Hello World” script with the same results

Thanks in Advance.

Howdy,

A handful of folks over the years have described seeing this particular issue; but I’ve had a bear of a time trying to determine the cause.

We don’t normally see that, normally CGI scripts work out of the box, and don’t need any tweaking.

For example, I just built a fresh CentOS 6 server to test that, and using the default settings, created a new Virtual server, put a test.pl script into the cgi-bin directory, and printed “Hello World” using it.

You can see this fellow from back in 2011 who had that… we looked at all sorts of stuff back then but just couldn’t nail down the cause:

https://www.virtualmin.com/node/19462

A few thoughts though that I’m not sure I asked him back then –

Did you build your CentOS install? Or is that an image put together by your provider?

Are any third party repositories enabled? For example, what is the output of this command: ls /etc/yum.repos.d/

What is the output of this command: rpm -qa | grep httpd

Just as a side note, my hello world program looks like this:

#!/usr/bin/perl

use warnings;
use strict;

use CGI;

print CGI->header();
print “Hello World”;

I had to install the “perl-CGI” before that would work, it otherwise throws an error.

-Eric

Output of ls /etc/yum.repos.d/

CentOS-Base.repo CentOS-Media.repo virtualmin.repo
CentOS-Debuginfo.repo CentOS-Vault.repo

Output of rpm -qa | grep httpd

httpd-tools-2.2.15-29.el6.vm.1.x86_64
httpd-2.2.15-29.el6.vm.1.x86_64

As for CentOS install this it is very default. The server is running in house on a Hyper-V server.
I did a net base install.

Then followed instructions to install VirtualMin GPL.

I did import a backup from my old VirtualMin server which was running VMin 3.94 gpl on CentOS Linux 6.3 Install was the same there except it is on a physical server instead of virtual.

Current server ins CentOS 6.4

One other note the CGI script is not a perl script. According to the software I generated the search with it is a binary executable. From what I can tell the server is not set to handle all CGI files as Perl but not exactly sure where to look.

Looking at the other post you mentioned I wanted to state that PHP works fine both with CGI and FCGId. Granted the php I am using is VERY simplistic but still it’s php.

It’s just the CGI script i am trying to run doesn’t work.

Thanks for the help!

I just tried the test perl script that you pasted as it differed from the one I had tried.

Before installing perl-CGI it gave an Internal Server Error. Then I installed perl-CGI and it worked fine.

Is it possible that I don’t have something installed that the CGI needs?

In response to my last post I thought back through all the Googling I had done and remembered another post.

It turns out I didn’t have glibc installed.

So if you are having trouble getting a CGI script to run find out wether the script is perl or c, or what ever else and make sure you have what is needed to run those scripts CGI.

I spent HOURS on this. I am glad to have it done but also mad that it was something as simple as installing something.

What I did to fix it was

yum install glibc.i686

Thanks for the help andreychek.

Also credit to this post: https://www.virtualmin.com/node/28115

Awesome, I’m glad that you got it working!