Apache2에서 PHP 4.x 버전과 연동시 undefined symbol: unixd_config 에러가 나는 경우가 있습니다.

root@ruo91:~# /usr/local/apache2/bin/apachectl
httpd: Syntax error on line 132 of /usr/local/apache2/conf/httpd.conf: Cannot load modules/libphp4.so into server: /usr/local/apache2/modules/libphp4.so: undefined symbol: unixd_config

이 문제는 Apache가 버전업을 하면서 unixd_config 심볼을 ap_unixd_config 로 변경하였기 때문에 문제가 발생 된겁니다.

해당 php 소스 디렉토리에 sapi/apache2handler/php_functions.c 을 열어 unixd_config 를 ap_unixd_config로 수정 하고, php를 재컴파일 하여 연동 하면 됩니다.

– php-4.4.9 버전 기준

/*
static char *php_apache_get_version()
{
    return (char *) ap_get_server_version();
}
*/
static char *php_apache_get_version()
    {
    #if MODULE_MAGIC_NUMBER_MAJOR >= 20060905
        return (char *) ap_get_server_banner();
    #else
        return (char *) ap_get_server_version();
    #endif
}
 PHP_MINFO_FUNCTION(apache)
{
    char *apv = php_apache_get_version();
    smart_str tmp1 = {0};
    char tmp[1024];
    int n, max_requests;
    char *p;
    server_rec *serv = ((php_struct *) SG(server_context))->r->server;
#if !defined(WIN32) && !defined(WINNT)
//    AP_DECLARE_DATA extern unixd_config_rec unixd_config;
    AP_DECLARE_DATA extern unixd_config_rec ap_unixd_config;
#endif
 #if !defined(WIN32) && !defined(WINNT)
//    snprintf(tmp, sizeof(tmp), "%s(%d)/%d", unixd_config.user_name, unixd_config.user_id, unixd_config.group_id);
    snprintf(tmp, sizeof(tmp), "%s(%d)/%d", ap_unixd_config.user_name, ap_unixd_config.user_id, ap_unixd_config.group_id);
    php_info_print_table_row(2, "User/Group", tmp);
#endif