Solved

Apache Custom Built DSO Question

Posted on 2011-02-12
6
357 Views
Last Modified: 2012-05-11
Hi,

I built the mod_echo example (attached) and Apache is refusing to load with it defined in the httpd conf file. What should I do?

I am running:
 Windows 7
 Apache 2.2

Apache does load successfully without the module defined.
Apache complains that it can not find the module mod_echo.so

Thanks in Advance!

/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "ap_config.h"
#include "ap_mmn.h"
#include "httpd.h"
#include "http_config.h"
#include "http_connection.h"

#include "apr_buckets.h"
#include "util_filter.h"

module AP_MODULE_DECLARE_DATA echo_module;

typedef struct {
    int bEnabled;
} EchoConfig;

static void *create_echo_server_config(apr_pool_t *p, server_rec *s)
{
    EchoConfig *pConfig = apr_pcalloc(p, sizeof *pConfig);

    pConfig->bEnabled = 0;

    return pConfig;
}

static const char *echo_on(cmd_parms *cmd, void *dummy, int arg)
{
    EchoConfig *pConfig = ap_get_module_config(cmd->server->module_config,
                                               &echo_module);
    pConfig->bEnabled = arg;

    return NULL;
}

static int process_echo_connection(conn_rec *c)
{
    apr_bucket_brigade *bb;
    apr_bucket *b;
    apr_status_t rv;
    EchoConfig *pConfig = ap_get_module_config(c->base_server->module_config,
                                               &echo_module);

    if (!pConfig->bEnabled) {
        return DECLINED;
    }

    do {
        bb = apr_brigade_create(c->pool, c->bucket_alloc);

        /* Get a single line of input from the client */
        if (((rv = ap_get_brigade(c->input_filters, bb, AP_MODE_GETLINE,
                                 APR_BLOCK_READ, 0)) != APR_SUCCESS) ||
             APR_BRIGADE_EMPTY(bb)) {
            apr_brigade_destroy(bb);
            break;
        }

        /* Make sure the data is flushed to the client */
        b = apr_bucket_flush_create(c->bucket_alloc);
        APR_BRIGADE_INSERT_TAIL(bb, b);

        /* Send back the data. */
        rv = ap_pass_brigade(c->output_filters, bb);
    } while (rv == APR_SUCCESS);

    return OK;
}

static const command_rec echo_cmds[] =
{
    AP_INIT_FLAG("ProtocolEcho", echo_on, NULL, RSRC_CONF,
                 "Run an echo server on this host"),
    { NULL }
};

static void register_hooks(apr_pool_t *p)
{
    ap_hook_process_connection(process_echo_connection, NULL, NULL,
                               APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA echo_module = {
    STANDARD20_MODULE_STUFF,
    NULL,                       /* create per-directory config structure */
    NULL,                       /* merge per-directory config structures */
    create_echo_server_config,  /* create per-server config structure */
    NULL,                       /* merge per-server config structures */
    echo_cmds,                  /* command apr_table_t */
    register_hooks              /* register hooks */
};

Open in new window

c:\>"C:\Apache\bin\httpd.exe" -k start
httpd.exe: Syntax error on line 39 of C:/Apache/conf/httpd.conf:
 line 1 of C:/Apache/conf/dynamic/modules.conf: Cannot load C:/Ap
d_echo.so into server: The specified module could not be found.

Open in new window

0
Comment
Question by:dilithiumtoys_dot_com
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 34881201
Are you sure the module gets copied to the location where Apache expects it during the build?
0
 

Author Comment

by:dilithiumtoys_dot_com
ID: 34881239
I checked the modules directory to make sure it was being built and placed in the location Apache would be looking for it.

LoadModule echo_module modules/mod_echo.so is in my conf file and I deleted the copy of mod_echo in the module directory and then recompiled.

The module was where it was suppose to be, but Apache is complaining it is not there. I adjusted the permissions and everything to allow full access.
0
 
LVL 86

Expert Comment

by:jkr
ID: 34881269
Cn you try "Process Explorer" (http://technet.microsoft.com/en-us/sysinternals/bb896653) to see if it is really trying to load that modue and if there are any issues during that process?
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:dilithiumtoys_dot_com
ID: 34881294
Ok. I have downloaded that, but I cant seem to find Apache or find it fast enough. Its like a second that its open.
0
 

Accepted Solution

by:
dilithiumtoys_dot_com earned 0 total points
ID: 34881376
I read this article http://groups.google.com/group/modwsgi/browse_frm/thread/c33b42bc9b86a4df?pli=1
and I am wondering if I am missing a needed DLL? Shouldnt this example be a standalone module?
0
 

Author Closing Comment

by:dilithiumtoys_dot_com
ID: 34986605
My solution worked.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question