apacheperlcgihttpd.conf

Perl script not displaying properly within Apache web server (Mac)


So I have a Perl script that I want to run within an Apache web server and everything seems to be working correctly except for the formatting. The server displays the Perl script as plain text rather than interpreting it.

I've tried changing the cgi files inside of httpd.conf but nothing seems to work. All of the solutions online relating to changing these settings haven't worked.

Here are a few of the changes I made:

httpd.conf

<IfModule !mpm_prefork_module>
    LoadModule cgid_module libexec/apache2/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
    #LoadModule cgi_module libexec/apache2/mod_cgi.so
</IfModule>
<Directory />
    AllowOverride None
    Options FollowSymLinks +ExecCGI
</Directory>
DocumentRoot "/usr/local/var/www/cgi-bin/"
<Directory "/usr/local/var/www/cgi-bin/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options ExecCGI +FollowSymLinks +Multiviews
    MultiviewsMatch Any

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
ScriptAlias /cgi-bin/ "/usr/local/var/www/cgi-bin/"
<Directory "/usr/local/var/www/cgi-bin/">
    AllowOverride None
    Options ExecCGI
    Require all granted
</Directory>

and inside of the mime_module (which doesn't apply to my program, but I changed it anyway)

AddHandler cgi-script .cgi
Options ExecGI

Solution

  • Long story short, I was editing the incorrect httpd.conf. I reinstalled Apache and obtained the pathing to the correct httpd.conf file to configure which fixed everything.