Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Incompatible with recent Nagvis #6

Open
sathieu opened this issue Oct 9, 2015 · 5 comments
Open

Incompatible with recent Nagvis #6

sathieu opened this issue Oct 9, 2015 · 5 comments

Comments

@sathieu
Copy link

sathieu commented Oct 9, 2015

With Nagvis 1.9b2, I have:

mod_fcgid: stderr: PHP Fatal error:  Cannot redeclare debug() (previously declared in /usr/share/centreon/www/modules/centreon-nagvis/index.php:158) in /usr/local/share/nagvis/share/server/core/functions/debug.php on line 43, 
mod_fcgid: stderr: PHP Fatal error:  Cannot redeclare get_error() (previously declared in /usr/share/centreon/www/include/common/common-Func.php:1751) in /usr/local/share/nagvis/share/server/core/functions/html.php on line 67, 
mod_fcgid: stderr: PHP Fatal error:  Cannot redeclare microtime_float() (previously declared in /usr/share/centreon/www/header.php:40) in /usr/local/share/nagvis/share/server/core/functions/debug.php on line 70, 

and maybe more...

@mathieuchateau
Copy link

me too with stable nagvis 1.8.5

@mathieuchateau
Copy link

I did a workaround on my side, waiting for official fix. I am afraid I am not understanding code good enough to know if my changes are correct:

Inside nagvis, line 30 nagvis/share/server/core/functions/debug.php, comment out:

//define('DEBUGSTART',microtime_float());

inside nagvis, like 76, nagvis/share/server/core/functions/html.php change to only declare if not already

if(function_exists('get_error')){
    // my_function is defined
}
else
{
function get_error($key) {
    global $form_errors;
    return isset($form_errors[$key]) ? $form_errors[$key] : array();
}
}

inside centreon, at end of centreon/www/modules/centreon-nagvis/index.php, comment out:

/*
function debug($msg) {
    $fh = fopen(DEBUGFILE, 'a');
    fwrite($fh, utf8_encode(microtime_float().' '.$msg."\n"));
    fclose($fh);
}
*/

@cemir
Copy link

cemir commented Dec 7, 2015

Hi,

same errors for me with Centreon 2.6.6 and NagVis 1.8.5

in addition of mathieuchateau's modifications, I had to comment in file nagvis/share/server/core/functions/debug.php

     67 /*
     68 function microtime_float() {
     69         list($usec, $sec) = explode(' ', microtime());
     70         return ((float)$usec + (float)$sec);
     71 }
     72 */

@RefreshMyMind
Copy link

In the root folder of nagvis, run the following:
sed -i -e "s/debug(/debug_nagvis(/g" ./share/server/core/ext/php-gettext-1.0.9/gettext.inc
sed -i -e "s/debug(/debug_nagvis(/g" ./share/server/core/classes/CoreAuthorisationHandler.php
sed -i -e "s/debug(/debug_nagvis(/g" ./share/server/core/classes/CoreSQLiteHandler.php
sed -i -e "s/debug(/debug_nagvis(/g" ./share/server/core/classes/GlobalLanguage.php
sed -i -e "s/debug(/debug_nagvis(/g" ./share/server/core/classes/CoreAuthHandler.php
sed -i -e "s/debug(/debug_nagvis(/g" ./share/server/core/classes/CoreMySQLHandler.php
sed -i -e "s/debug(/debug_nagvis(/g" ./share/server/core/functions/debug.php
sed -i -e "s/microtime_float(/microtime_float_nagis(/g" ./share/server/core/functions/debug.php

@kozfelipe
Copy link

I got the same issue. Thanks for the workaround.
Still waiting on an official fix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants