Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9266797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T14:24:01+00:00 2026-06-18T14:24:01+00:00

While configuring with apache and perl cgi scripts , don’t know why index.cgi /

  • 0

While configuring with apache and perl cgi scripts, don’t know why index.cgi/index.pl are displayed as plain text instead of executing them.
When I put http://localhost in browser it displays below code, instead of executing it.

List item
    #!C:/Dwimperl/perl/bin/perl.exe -w

     print "Content-type: text/html\n\n";
        print <<HTML;
        <html>
        <head>
        <title>A perl web page</title>
        </head>
        <body>
        <h3>A hello world form perl</h3>
        </body>

        HTML
        exit;

This are parts of httpd.conf file which I have edited most of the times (after reading various online reference, tutorials)

# This should be changed to whatever you set DocumentRoot to.
<Directory "D:\webserver">

Listen 80
ServerName localhost:80
LoadModule cgi_module modules/mod_cgi.so

# First, we configure the "default" to be a very restrictive set of 
# features.  
<Directory />
    Options FollowSymLinks +ExecCGI
    AllowOverride None
</Directory>

DirectoryIndex index.html index.html.var index.cgi index.pl

AccessFileName .htaccess

# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi .pl

ScriptAlias /cgi-bin/ "C:/Apache/Apache2/cgi-bin/"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T14:24:02+00:00Added an answer on June 18, 2026 at 2:24 pm

    When browser is printing code of script that means it’s unable to find the application to run the script. Below two lines should be your first steps to solve this. AddHandler will make sure files ending with .cgi and .pl to be treated as cgi scripts. And +ExecCGI option will allow to execute the script. Also make sure your script is pointing to correct perl binary location.

        AddHandler cgi-script .cgi .pl
        Options FollowSymLinks +ExecCGI
    

    Also There are some mistakes/misconfiguration points in your httpd.conf

    • Alias line should point to cgi-bin directory where your cgi scripts are present.

    ScriptAlias /cgi-bin/ “D:\webserver\cgi-bin”

    • For same cgi-bin directory following configuration should be in httpd.conf. You should replace your <Directory "D:\webserver"> part with below.
    <Directory "D:\webserver\cgi-bin" />
        AddHandler cgi-script .cgi .pl
        Options FollowSymLinks +ExecCGI
        AllowOverride None  
    </Directory>
    
    • Try running your cgi script from command line like below. It should print or run from command line first.

    perl test.cgi

    • Make sure you have read-write recursive permissions to cgi-bin directory and your cgi script. And also you can create directory or file with write permissions. If not create a cgi-bin directory at some other place where you can have write permissions and provide rather its path in alias and directory attributes in httpd.conf instead.
    • Check apache error log for exact error message every time you run into apache conf issues. It will give you good insight into the problem.

    Also this link should help you.

    (Extra comment, not by the original answerer: You may also need to enable the cgi module. For me, the final step to getting cgi to work on a fresh install of Apache 2 was sudo a2enmod cgi. Before I did that, the website simply showed me the contents of the script.)

    sudo a2enmod cgi

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting Following Exception while configuring the Connection Pool in Tomcat This is
While configuring the security constraints for a web-module's roles in J2EE application I'm having
While configuring my just installed Visual Studio 2010 Professional, I mistakenly opted for Visual
Following error found while configuring ITK with GDCM2.2 CMake Error at Modules/ThirdParty/GDCM/itk-module-init.cmake:5 (find_package): By
While configuring cpan with o conf init : I'm getting following error: If you're
While trying to compile the latest version of the apache web server(2.4.3) on my
While configuring FLOW3, I get the following error #1315561483: It seems like the PHP
I've got a problem while I'm configuring my web site in IIs 7, when
While configuring inapp products on play.google.com, I am unable to charge 0.99 USD for
Can i use a proxy service without a business service while configuring message flows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.