CGI not working on Fedora19, Apache 2.2

Trying to get cgi script executed on my desktop running Fedora 19 + Apache 2.2.
All setting are  triple checked according to Apache manual.
httpd.conf contains:
<Directory "/usr/local/apache2/cgi-bin">
    AddHandler cgi-script .cgi .pl
    AllowOverride All
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>

Open in new window

The file first.cgi is in the directory /usr/local/apache2/cgi-bin
chmod a+x first.cgi
/usr/local/apache2/bin/apachectl -k restart
first.cgi content:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World."; 

Open in new window


Now when I try to open first.cgi in Firefox,
it either literally shows its content (if reading was permitted), or does nothing (if reading was not permitted).
Al283Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BullockQA EngineerCommented:
Is the path to the Perl interpreter, /usr/bin/perl, correct?
Can you execute the perl script from the command line?
e.g. perl /usr/local/apache2/cgi-bin/first.cgi
and
/usr/local/apache2/cgi-bin/first.cgi
Al283Author Commented:
From the command line executes OK both ways.
matrix8086Commented:
Did you installed php-cgi, perl-cgi?

Did you enabled CGI exec in https.conf?

Options FollowSymLinks ExecCGI

AddHandler cgi-script .cgi .pl
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Al283Author Commented:
ServerRoot "/usr/local/apache2"
Listen 80
AddHandler cgi-script .cgi .pl
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon
Group daemon
</IfModule>
</IfModule>
ServerAdmin you@example.com
DocumentRoot "/usr/local/apache2/htdocs"
    AddHandler cgi-script .cgi
<Directory />
    Options FollowSymLinks ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
<Directory "/usr/local/apache2/htdocs">
    Options Indexes FollowSymLinks ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "logs/access_log" common
</IfModule>
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
AddHandler cgi-script .cgi .pl
<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride All
    Options ExecCGI
    Order allow,deny
    Allow from all
</Directory>
DefaultType text/plain
<IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddHandler cgi-script .cgi
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

Open in new window

Al283Author Commented:
php-cgi, perl-cgi are installed now.
Doesn't help.

Options FollowSymLinks ExecCGI
AddHandler cgi-script .cgi .pl

are there.
Al283Author Commented:
No trace of cgi loading attempt is recorded in log files.
giltjrCommented:
Can you verify that you have:

LoadModule cgi_module modules/mod_cgi.so

Which should be in /etc/httpd/conf.d/modules.conf.
Al283Author Commented:
[root@localhost conf.d]# ls
autoindex.conf  README  userdir.conf  welcome.conf

There is no modules.conf.

attempt to add LoadModule cgi_module modules/mod_cgi.so to httpd.conf yields

[root@localhost modules]# httpd -k restart
[Tue Jun 02 09:54:49.743218 2015] [so:warn] [pid 8579] AH01574: module cgi_module is already loaded, skipping
giltjrCommented:
O.K. that location was from memory, looks like Fedora has moved the LoadModule statements to

/etc/httpd/conf.modules.d

in various configuration file.

How did you install Apache?  When I do "yum install httpd" I get the Fedora setup for Apache.   Which  is slightly different from the Apache setup you seem to have.

Are you getting any errors in your error_log for Apache?
giltjrCommented:
Have you looked for errors in your error_log yet?  Looking at your config I don't see anything obviously wrong.  You have a few options coded that should allow you to execute CGI scripts outside of the directory "/usr/local/apache2/cgi-bin/, but that should not prevent you from executing CGI scripts that are located there.
Al283Author Commented:
My cgi script appeared to execute only when called from within html file. Direct substitution of cgi file address into address bar of Firefox doesn't work. And I still can't figure out why.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
giltjrCommented:
Just to make sure you are entering:

http://hostname/cgi-bin/first.cgi
Al283Author Commented:
No solution found.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.