Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache don't interpret Perl
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
evilAngel
n00b
n00b


Joined: 21 Jul 2004
Posts: 53
Location: France

PostPosted: Wed Dec 29, 2010 9:46 am    Post subject: Apache don't interpret Perl Reply with quote

Hey all,

I am trying to setup Apache in order to use a Perl CGI.
However, I can't have it working, the source code is displayed in my web browser instead of being executed.

Here are the flags I used to emerge Apache:

Code:
r34# equery uses apache                     
[ Searching for packages matching apache... ]
[ Colour Code : set unset ]
[ Legend : Left column  (U) - USE flags from make.conf              ]
[        : Right column (I) - USE flags packages was installed with ]
[ Found these USE variables for www-servers/apache-2.2.16 ]
 U I
 + + apache2_modules_actions         : Provides for executing CGI scripts based on media type or request method
 + + apache2_modules_alias           : Provides for mapping different parts of the host filesystem in the document tree and for URL redirection
 - - apache2_modules_asis            : Sends files that contain their own HTTP headers
 + + apache2_modules_auth_basic      : Basic authentication
 - - apache2_modules_auth_digest     : User authentication using MD5 Digest Authentication
 + + apache2_modules_authn_alias     : Provides the ability to create extended authentication providers based on actual providers
 + + apache2_modules_authn_anon      : Allows "anonymous" user access to authenticated areas
 - - apache2_modules_authn_dbd       : User authentication using an SQL database
 + + apache2_modules_authn_dbm       : User authentication using DBM files
 + + apache2_modules_authn_default   : Authentication fallback module
 + + apache2_modules_authn_file      : User authentication using text files
 + + apache2_modules_authz_dbm       : Group authorization using DBM files
 + + apache2_modules_authz_default   : Authorization fallback module
 + + apache2_modules_authz_groupfile : Group authorization using plaintext files
 + + apache2_modules_authz_host      : Group authorizations based on host (name or IP address)
 + + apache2_modules_authz_owner     : Authorization based on file ownership
 + + apache2_modules_authz_user      : User Authorization
 + + apache2_modules_autoindex       : Generates directory indexes, automatically, similar to the Unix ls command
 + + apache2_modules_cache           : Content cache keyed to URIs
 - - apache2_modules_cern_meta       : CERN httpd metafile semantics
 + + apache2_modules_cgi             : Enable CGI module (used by non-multithreaded MPMs, for eg. prefork)
 + + apache2_modules_cgid            : Enable CGI module (used by multithreaded MPMs, for eg. worker)
 - - apache2_modules_charset_lite    : Specify character set translation or recoding
 + + apache2_modules_dav             : Distributed Authoring and Versioning (WebDAV) functionality
 + + apache2_modules_dav_fs          : filesystem provider for mod_dav
 + + apache2_modules_dav_lock        : generic locking module for mod_dav
 - - apache2_modules_dbd             : Manages SQL database connections
 + + apache2_modules_deflate         : Compress content before it is delivered to the client
 + + apache2_modules_dir             : Provides for "trailing slash" redirects and serving directory index files
 + + apache2_modules_disk_cache      : Content cache storage manager keyed to URIs
 - - apache2_modules_dumpio          : Dumps all I/O to error log as desired
 + + apache2_modules_env             : Modifies the environment which is passed to CGI scripts and SSI pages
 + + apache2_modules_expires         : Generation of Expires and Cache-Control HTTP headers according to user-specified criteria
 + + apache2_modules_ext_filter      : Pass the response body through an external program before delivery to the client
 + + apache2_modules_file_cache      : Caches a static list of files in memory
 + + apache2_modules_filter          : Context-sensitive smart filter configuration module
 + + apache2_modules_headers         : Customization of HTTP request and response headers
 - - apache2_modules_ident           : RFC 1413 ident lookups
 - - apache2_modules_imagemap        : Server-side imagemap processing
 + + apache2_modules_include         : Server-parsed html documents (Server Side Includes)
 + + apache2_modules_info            : Provides a comprehensive overview of the server configuration
 + + apache2_modules_log_config      : Logging of the requests made to the server
 - - apache2_modules_log_forensic    : Forensic Logging of the requests made to the server
 + + apache2_modules_logio           : Logging of input and output bytes per request
 + + apache2_modules_mem_cache       : Content cache keyed to URIs
 + + apache2_modules_mime            : Associates the requested filename's extensions with the file's behavior (handlers and filters) and content (mime-type, language, character set and encoding)
 + + apache2_modules_mime_magic      : Determines the MIME type of a file by looking at a few bytes of its contents
 + + apache2_modules_negotiation     : Provides for content negotiation
 - - apache2_modules_proxy           : HTTP/1.1 proxy/gateway server
 - - apache2_modules_proxy_ajp       : AJP support module for mod_proxy
 - - apache2_modules_proxy_balancer  : mod_proxy extension for load balancing
 - - apache2_modules_proxy_connect   : mod_proxy extension for CONNECT request handling
 - - apache2_modules_proxy_ftp       : FTP support module for mod_proxy
 - - apache2_modules_proxy_http      : HTTP support module for mod_proxy
 + + apache2_modules_rewrite         : Provides a rule-based rewriting engine to rewrite requested URLs on the fly
 + + apache2_modules_setenvif        : Allows the setting of environment variables based on characteristics of the request
 + + apache2_modules_speling         : Attempts to correct mistaken URLs that users might have entered by ignoring capitalization and by allowing up to one misspelling
 + + apache2_modules_status          : Provides information on server activity and performance
 - - apache2_modules_substitute      : Perform search and replace operations on response bodies
 + + apache2_modules_unique_id       : Provides an environment variable with a unique identifier for each request
 + + apache2_modules_userdir         : User-specific directories
 + + apache2_modules_usertrack       : Clickstream logging of user activity on a site
 - - apache2_modules_version         : Version dependent configuration
 + + apache2_modules_vhost_alias     : Provides for dynamically configured mass virtual hosting
 - - apache2_mpms_event              : An experimental variant of the standard worker MPM
 - - apache2_mpms_itk                : Allows to run each virtual host under a separate uid and gid
 - - apache2_mpms_peruser            : Peruser is a working implementation of the perchild MPM allowing to run each apache child process as its own user and group, each handling its own set of virtual hosts
 - - apache2_mpms_prefork            : Implements a non-threaded, pre-forking web server
 - - apache2_mpms_worker             : Multi-Processing Module implementing a hybrid multi-threaded multi-process web server
 - - debug                           : Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see http://www.gentoo.org/proj/en/qa/backtraces.xml
 - - doc                             : Adds extra documentation (API, Javadoc, etc)
 - - ldap                            : Adds LDAP support (Lightweight Directory Access Protocol)
 - - selinux                         : !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
 + + ssl                             : Adds support for Secure Socket Layer connections
 - - static                          : !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically
 - - suexec                          : Install suexec with apache
 - - threads                         : Adds threads support for various packages. Usually pthreads
r34 modules.d #


Here are the options used in /etc/conf.d/apache2 file:
Code:
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE
-D CGI -D PERL"


Here is my /etc/apache2/httpd.conf file:
Code:
r34 modules.d # grep -v "#" /etc/apache2/httpd.conf

ServerRoot "/usr/lib64/apache2"


LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
<IfDefine CACHE>
LoadModule cache_module modules/mod_cache.so
</IfDefine>
LoadModule cgi_module modules/mod_cgi.so
LoadModule cgid_module modules/mod_cgid.so
<IfDefine DAV>
LoadModule dav_module modules/mod_dav.so
</IfDefine>
<IfDefine DAV>
LoadModule dav_fs_module modules/mod_dav_fs.so
</IfDefine>
<IfDefine DAV>
LoadModule dav_lock_module modules/mod_dav_lock.so
</IfDefine>
LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
<IfDefine CACHE>
LoadModule disk_cache_module modules/mod_disk_cache.so
</IfDefine>
LoadModule env_module modules/mod_env.so
LoadModule expires_module modules/mod_expires.so
LoadModule ext_filter_module modules/mod_ext_filter.so
<IfDefine CACHE>
LoadModule file_cache_module modules/mod_file_cache.so
</IfDefine>
LoadModule filter_module modules/mod_filter.so
LoadModule headers_module modules/mod_headers.so
LoadModule include_module modules/mod_include.so
<IfDefine INFO>
LoadModule info_module modules/mod_info.so
</IfDefine>
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
<IfDefine CACHE>
LoadModule mem_cache_module modules/mod_mem_cache.so
</IfDefine>
LoadModule mime_module modules/mod_mime.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule speling_module modules/mod_speling.so
<IfDefine SSL>
LoadModule ssl_module modules/mod_ssl.so
</IfDefine>
<IfDefine STATUS>
LoadModule status_module modules/mod_status.so
</IfDefine>
LoadModule unique_id_module modules/mod_unique_id.so
<IfDefine USERDIR>
LoadModule userdir_module modules/mod_userdir.so
</IfDefine>
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so

User apache
Group apache

Include /etc/apache2/modules.d/*.conf

Include /etc/apache2/vhosts.d/*.conf
r34 modules.d #


Here is the configuration of the vhost:
Code:
<VirtualHost *:443>
                                SSLEngine on
                                 SSLCertificateFile /etc/apache2/serverWWW.crt
                                 SSLCertificateKeyFile /etc/apache2/serverWWW.key

                                 ServerName XXXXXXX.me
                                 SSLOptions StrictRequire
                                 SSLProtocol all -SSLv2

                                 DocumentRoot /var/www/test
                                 <Directory /var/www/test/>
                                          SSLRequireSSL
                                        Order Deny,Allow
                                        Allow from All
                                </Directory>
                        </VirtualHost>


Any idea what I forgot to change in order to make it work?

Thanks!
Back to top
View user's profile Send private message
keyson
l33t
l33t


Joined: 10 Jun 2003
Posts: 830
Location: Sweden

PostPosted: Wed Dec 29, 2010 10:30 am    Post subject: Reply with quote

Hey,

Check the handler in:
/etc/apache2/modules.d/

You should have something like this ( but this is for php5)

A file: 70_mod_php5.conf (but for perl)

Content:
<IfDefine PHP5>
# Load the module first
<IfModule !mod_php5.c>
LoadModule php5_module modules/libphp5.so
</IfModule>

# Set it to handle the files
<IfModule mod_mime.c>
AddHandler application/x-httpd-php .php .php5 .phtml
AddHandler application/x-httpd-php-source .phps
</IfModule>

DirectoryIndex index.php index.phtml
</IfDefine>

For I can not see that it is loaded in your httpd.conf. So it is included from
/etc/apache2/modules.d/ . So it need a file that check if PERL is defined (in /etc/conf.d/apache2)
so it load the module and set the handler.

Regards
Back to top
View user's profile Send private message
keyson
l33t
l33t


Joined: 10 Jun 2003
Posts: 830
Location: Sweden

PostPosted: Tue Jan 04, 2011 1:10 pm    Post subject: Reply with quote

Btw have you emerged mod_perl ?
Back to top
View user's profile Send private message
bluescream?
n00b
n00b


Joined: 26 Nov 2002
Posts: 27
Location: Germany

PostPosted: Mon Jan 10, 2011 9:34 pm    Post subject: Reply with quote

apache has a tutorial for enabling CGI available: http://httpd.apache.org/docs/2.2/howto/cgi.html
_________________
Roses are grey, violets are grey, I'm dead and colorblind.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum