1
votes

My Server is
CentOS7
Apache 2.4
SELinux enabled.

Perl/CGI is working for /var/www/cgi-bin directory but not working for /home/user/cgi directory.

error-log shows the following errors for test.pl:

[Fri Jan 08 19:53:05.725795 2016] [cgi:error] [pid 7311] [client *:33769] End of script output before headers: test.pl
[Fri Jan 08 19:54:10.981964 2016] [cgi:error] [pid 7314] [client *:33770] End of script output before headers: test.pl

perl -w test.pl shows no error on command line.

SELinux settings for /home/user/cgi directory is

drwxr-xr-x.  4 unconfined_u:object_r:httpd_sys_script_exec_t:s0 user user   83 Jan  8 20:05 .
drwxr-xr-x. 11 unconfined_u:object_r:user_home_dir_t:s0 user user 4096 Jan  7 12:08 ..
-rwxr-xr-x.  1 unconfined_u:object_r:httpd_sys_script_exec_t:s0 user user   90 Jan  8 20:05 test.pl

Content of test.pl

#!/usr/bin/perl

print "Content-type: text/html; charset=utf-8\n\n";
print "Hello\n\n";

httpd.conf

Options Indexes FollowSymLinks Includes ExecCGI
AddHandler cgi-script .cgi .pl
Require all granted
DirectoryIndex index.pl index.cgi 

Link to httpd related sebool options: sebool Greatly appreciate help...

1
Is there anything in the Apache error log? (Might be something like /var/log/apache2/error.log).Grant McLean
I did not see anything relating to this error in /var/log/httpd/error_log. Nevertheless, here is the link to the log contents. Maybe i have missed something! : [link] (business-impact-solutions.com/error_log_2016-08-01.txt)bislinks
maybe it's the old file buffering thing? try putting $|=1; before any of the print statements in your script.Doggerel
No, $|=1; did not solve the issuebislinks
I assume the section of httpd.conf you showed is inside a <Directory> block. Which directory? (You need to show the configuration for both /var/www/cgi-bin and /home/user/cgi for us to be able to help.)ThisSuitIsBlackNot

1 Answers

0
votes

I got it.

The problem was caused by this line:

SuexecUserGroup "#1000" "#1000"

Problem resolved once I removed that directive.