我有一个阿帕奇模块,在CentOS适当运作,但乌班图失败。 我已把问题跟踪到请求记录中载有在<代码>request_rec上存档名称的NUL价值。 用于检查所处理档案档案的档案类型,因此,Pharma正作为理由向我模块中界定的“一” h功能。
i.e.,
extern "C" module AP_MODULE_DECLARE_DATA MyModule = {
STANDARD20_MODULE_STUFF, // initializer
NULL, // create per-dir config
NULL, // merge per-dir config
NULL, // server config
NULL, // merge server config
MyCommandTable, // command table
MyRegisterHooks // register hooks
};
......
static void MyRegisterHooks(apr_pool_t *p)
{
ap_hook_child_init(MyPluginInit, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_type_checker(MyCheckAppFileType, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_handler(MyFileHandler,NULL,NULL,APR_HOOK_MIDDLE);
}
......,最后,罪犯职能:
static int MyCheckAppFileType(request_rec *ap_req)
{
if(ap_req == NULL)
{
return DECLINED; // Not reached
}
if(ap_req->filename == NULL)
{
return DECLINED; // HERE is the problem ... Why is ap_req->filename NULL?
// On CentOS it is not NULL, only on Ubuntu.
}
// ...
}
我在乌班图和中西斯两地都使用帕帕帕奇2.2,我独立地从两个系统的头盔中修建了单元。
FURTHER INFO ~3 months later: I have discovered that building the module on CentOS, and then copying the binary over to Ubuntu, and it works. Taking the identical code and building it on Ubuntu causes the above failure at runtime. Therefore, the code does not necessarily seem to be the problem -- or at least there is something being handled by the compiler differently on the two systems that is causing success with the CentOS build but not the Ubuntu build.