Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.63k stars 403 forks source link

[1.2.0] Installer seems stuck at installing packages due to missing PHP modules/functions #1871

Closed netniV closed 6 years ago

netniV commented 6 years ago
2018/08/23 23:02:23 - INSTALL: Importing Package #1 'Cisco_Router.xml.gz'

If the installer is left alone, it will restart after the allotted timeout and attempt to upgrade the database tables, and run the package installer a second time, again hanging on it.

netniV commented 6 years ago

Tracked down the likely culprit as being:

sudo -u www php -q ../../cli/import_package.php --filename=Cisco_Router.xml.gz
Read 43684 bytes of Package data
PHP Fatal error:  Call to undefined function hash() in /usr/share/cacti/site/lib/utility.php on line 30

Fatal error: Call to undefined function hash() in /usr/share/cacti/site/lib/utility.php on line 30
pautiina commented 6 years ago

dependency: phpXX-hash-XXX

pautiina commented 6 years ago

Full list of dependencies:

        php56-session: 5.6.37
        php56: 5.6.37
        php56-xml: 5.6.37
        php56-simplexml: 5.6.37
        php56-ctype: 5.6.37
        php56-posix: 5.6.37
        php56-openssl: 5.6.37
        php56-hash: 5.6.37
        php56-filter: 5.6.37
        php56-sockets: 5.6.37
        php56-ldap: 5.6.37
        php56-snmp: 5.6.37
        php56-gmp: 5.6.37
        php56-gd: 5.6.37
        php56-json: 5.6.37
        php56-gettext: 5.6.37
        rrdtool: 1.7.0_2
        php56-pdo_mysql: 5.6.37
        php56-pdo: 5.6.37
        php56-mysql: 5.6.37
        mysql56-client: 5.6.41
        php56-mbstring: 5.6.37
        php56-zlib: 5.6.37
netniV commented 6 years ago

Yeah, more to the point, the cli crashing should be picked up. At least I know how to make these errors happen to be able to replicate 👍

netniV commented 6 years ago

Also wrote this:

php find-func.php hash
      hash -> hash
      hash -> hash_file
      hash -> hash_hmac
      hash -> hash_hmac_file
      hash -> hash_init
      hash -> hash_update
      hash -> hash_update_stream
      hash -> hash_update_file
      hash -> hash_final
      hash -> hash_copy
      hash -> hash_algos
      hash -> hash_hmac_algos
      hash -> hash_pbkdf2
      hash -> hash_equals
      hash -> hash_hkdf
      hash -> mhash_keygen_s2k
      hash -> mhash_get_block_size
      hash -> mhash_get_hash_name
      hash -> mhash_count
      hash -> mhash
       SPL -> spl_object_hash
    sodium -> sodium_crypto_generichash
    sodium -> sodium_crypto_generichash_keygen
    sodium -> sodium_crypto_generichash_init
    sodium -> sodium_crypto_generichash_update
    sodium -> sodium_crypto_generichash_final
    sodium -> sodium_crypto_pwhash
    sodium -> sodium_crypto_pwhash_str
    sodium -> sodium_crypto_pwhash_str_verify
    sodium -> sodium_crypto_pwhash_str_needs_rehash
    sodium -> sodium_crypto_pwhash_scryptsalsa208sha256
    sodium -> sodium_crypto_pwhash_scryptsalsa208sha256_str
    sodium -> sodium_crypto_pwhash_scryptsalsa208sha256_str_verify
    sodium -> sodium_crypto_shorthash
    sodium -> sodium_crypto_shorthash_keygen
  standard -> password_hash
  standard -> password_needs_rehash
  standard -> ezmlm_hash
netniV commented 6 years ago

That is module -> function

netniV commented 6 years ago

So, it would seem we have some pre-requisite updates needed for the system. The required module list was green when I attempted the install which is incorrect.

netniV commented 6 years ago

Wrote a script to pull out the functions, and then list all modules with the functions they have that are used by the core Cacti scripts:

Found 490 functions in 49 modules, across 277 files
Module <Unknown> ...
    Header(1), WordWrap(2), Crypt(20), Hash(5), File(4)
    clearStatCache(1), System(3), ImageCreate(1)
    ImageColorAllocate(1), ImageFilledRectangle(1), ImageString(1)

Module Core ...
    func_num_args(1), func_get_args(9), strlen(65), strcmp(7)
    strcasecmp(1), each(1), error_reporting(25), define(24)
    defined(30), get_class(1), get_called_class(1)
    method_exists(2), property_exists(1), class_exists(4)
    function_exists(43), is_a(2), get_object_vars(2)
    trigger_error(3), user_error(11), set_error_handler(11)
    restore_error_handler(10), create_function(1), get_resource_type(1)
    extension_loaded(10), debug_backtrace(2), gc_collect_cycles(1)
    gc_enable(1)

Module PDO ...

Module Phar ...

Module Reflection ...

Module SPL ...
    spl_autoload_register(1)

Module SimpleXML ...
    simplexml_load_string(2)

Module Zend OPcache ...

Module calendar ...

Module ctype ...
    ctype_alnum(1), ctype_xdigit(1)

Module date ...
    strtotime(16), date(38), gmdate(3), mktime(2), strftime(1)
    time(45), localtime(1)
    date_default_timezone_set(1), date_default_timezone_get(2)

Module dom ...

Module exif ...

Module fileinfo ...

Module filter ...
    filter_var(6), filter_id(1)

Module ftp ...

Module gd ...
    imagecolorat(1), imagecolorallocate(2)
    imagecolortransparent(1), imagecopy(2), imagecopyresized(1)
    imagecreatetruecolor(2), imagetruecolortopalette(1)
    imagesavealpha(1), imagecolorallocatealpha(1)
    imagecreatefrompng(2), imagecreatefromgif(1), imagepng(1)
    imagegif(2), imagejpeg(1), imagedestroy(2)
    imagefill(1), imagefilledrectangle(1)
    imagefontwidth(1), imagefontheight(1), imagestring(2)
    imagesx(1), imagesy(1), imagettfbbox(1)
    imagettftext(2)

Module gettext ...
    ngettext(2)

Module gmp ...
    gmp_init(1), gmp_import(1), gmp_export(1)
    gmp_strval(1), gmp_add(1), gmp_sub(1), gmp_mul(1)
    gmp_div_qr(1), gmp_div_q(1), gmp_neg(1), gmp_abs(1)
    gmp_pow(1), gmp_powm(1), gmp_prob_prime(1)
    gmp_gcdext(1), gmp_invert(1), gmp_cmp(1), gmp_sign(1)
    gmp_and(1), gmp_or(1), gmp_xor(1), gmp_setbit(1)
    gmp_nextprime(1)

Module hash ...
    hash(10), hash_hmac(3), hash_algos(2)
    hash_pbkdf2(1), mhash(1)

Module iconv ...

Module json ...
    json_encode(21), json_decode(8)

Module ldap ...
    ldap_connect(1), ldap_close(1), ldap_bind(1)
    ldap_search(1), ldap_first_entry(1), ldap_get_entries(1)
    ldap_get_dn(1), ldap_errno(1), ldap_error(1)
    ldap_compare(1), ldap_set_option(1), ldap_start_tls(1)

Module libxml ...

Module mbstring ...
    mb_strlen(2), mb_substr(1), mb_convert_encoding(1)
    mb_detect_encoding(1), mb_check_encoding(1)

Module mysqli ...

Module mysqlnd ...

Module openssl ...
    openssl_pkey_free(1), openssl_pkey_new(1)
    openssl_pkey_export(1), openssl_pkey_get_private(1)
    openssl_pkey_get_details(2), openssl_encrypt(1), openssl_decrypt(1)
    openssl_sign(1), openssl_verify(1), openssl_pkcs7_sign(1)
    openssl_private_encrypt(1), openssl_public_encrypt(1)
    openssl_get_md_methods(1), openssl_get_cipher_methods(1)
    openssl_random_pseudo_bytes(1), openssl_error_string(2)

Module pcntl ...
    pcntl_signal(8)

Module pcre ...
    preg_match(79), preg_match_all(9), preg_replace(27)
    preg_replace_callback(4), preg_split(13), preg_quote(3)
    preg_last_error(1)

Module pdo_mysql ...

Module posix ...
    posix_kill(4), posix_getuid(2), posix_geteuid(1)
    posix_seteuid(1), posix_getgrgid(1), posix_getpwuid(2)

Module readline ...

Module session ...
    session_name(3), session_id(7), session_start(4)
    session_destroy(2), session_unset(1)
    session_set_save_handler(1), session_cache_limiter(1)
    session_write_close(6), session_status(1)

Module shmop ...

Module snmp ...
    snmpget(1), snmpgetnext(1), snmprealwalk(1)
    snmp_get_quick_print(1), snmp_set_quick_print(2)
    snmp_set_enum_print(2), snmp_set_oid_output_format(2)
    snmp_set_oid_numeric_print(1), snmp2_get(1), snmp2_getnext(1)
    snmp2_real_walk(1), snmp3_get(1), snmp3_getnext(1)
    snmp3_real_walk(1), snmp_set_valueretrieval(1)
    snmp_get_valueretrieval(1)

Module sockets ...
    socket_select(1), socket_create(2), socket_set_block(1)
    socket_close(2), socket_write(2), socket_read(1)
    socket_connect(2), socket_strerror(1), socket_recv(1)
    socket_set_option(1), socket_shutdown(2), socket_last_error(1)
    socket_clear_error(1)

Module sodium ...

Module standard ...
    constant(1), bin2hex(6), sleep(8), usleep(4), flush(4)
    wordwrap(2), htmlspecialchars(9), htmlentities(2)
    html_entity_decode(3), get_html_translation_table(1), sha1(6)
    md5(9), md5_file(3), phpinfo(3), phpversion(1)
    php_sapi_name(1), php_uname(7), strnatcmp(1)
    strnatcasecmp(2), substr_count(33), strtok(3)
    strtoupper(10), strtolower(38), strpos(80), stripos(4)
    strrpos(4), strrev(4), nl2br(1), basename(21)
    dirname(39), pathinfo(2), stripslashes(4), strstr(19)
    stristr(2), strrchr(1), str_split(4), utf8_decode(2)
    substr(70), substr_replace(4), ucfirst(7), ucwords(5)
    strtr(4), addslashes(3), addcslashes(1), rtrim(8)
    str_replace(76), str_ireplace(4), str_repeat(12)
    chunk_split(5), trim(72), ltrim(6), strip_tags(6)
    explode(103), implode(57), join(1), setlocale(2)
    localeconv(1), chr(18), ord(17), parse_str(1), str_pad(19)
    strchr(1), sprintf(20), printf(6), vsprintf(1)
    sscanf(1), parse_url(4), urlencode(1), urldecode(1)
    rawurlencode(1), rawurldecode(1), http_build_query(1)
    readlink(1), symlink(1), link(1), unlink(12), exec(12)
    system(1), escapeshellcmd(3), escapeshellarg(4)
    shell_exec(11), proc_open(4), proc_close(4), rand(11)
    mt_rand(9), random_bytes(1), getmypid(5)
    base64_decode(10), base64_encode(15), password_hash(1)
    password_needs_rehash(1), password_verify(1), abs(5), ceil(8)
    floor(15), round(30), pow(5), sqrt(2), bindec(2)
    hexdec(10), octdec(1), decbin(1), decoct(1), dechex(4)
    number_format(3), fmod(3), inet_ntop(1), inet_pton(3)
    getenv(5), putenv(3), getopt(3), microtime(28)
    uniqid(2), quoted_printable_encode(1)
    get_current_user(1), set_time_limit(5)
    get_magic_quotes_gpc(1), get_magic_quotes_runtime(1)
    error_log(2), error_get_last(1), call_user_func(12)
    call_user_func_array(18), serialize(40), unserialize(7)
    var_export(6), print_r(2), memory_get_usage(2)
    memory_get_peak_usage(2), register_shutdown_function(2)
    ini_get(15), ini_set(35), set_include_path(2)
    setcookie(5), header(112), parse_ini_file(3)
    gethostbyaddr(2), gethostbyname(3), gethostname(4)
    dns_get_record(1), intval(20), floatval(1), strval(7)
    gettype(1), is_null(9), is_resource(10), is_bool(4)
    is_int(4), is_float(2), is_numeric(55), is_string(9)
    is_array(60), is_object(12), is_callable(6), pclose(5)
    popen(6), rewind(2), rmdir(2), fclose(26), feof(8)
    fgets(15), fread(15), fopen(22), ftruncate(1), fstat(1)
    fseek(4), ftell(3), fflush(3), fwrite(19), fputs(9)
    mkdir(10), rename(4), copy(4), tempnam(4), file(5)
    file_get_contents(18), file_put_contents(11), stream_select(2)
    stream_context_create(6), stream_context_get_params(1)
    stream_context_get_options(1), stream_socket_client(1)
    stream_socket_enable_crypto(1), stream_copy_to_stream(1)
    stream_get_contents(1), fputcsv(1), stream_set_blocking(3)
    stream_get_meta_data(4), stream_get_line(1)
    stream_wrapper_register(1), stream_get_wrappers(1)
    stream_set_timeout(4), realpath(3), fsockopen(8), pack(21)
    unpack(22), opendir(8), closedir(7), chdir(12)
    getcwd(1), readdir(8), dir(2), scandir(7), glob(1)
    fileatime(1), filegroup(7), filemtime(4), fileowner(8)
    fileperms(3), filesize(8), filetype(2), file_exists(48)
    is_writable(16), is_writeable(3), is_readable(13)
    is_executable(4), is_file(10), is_dir(22), is_link(1), stat(2)
    lstat(2), chown(7), chgrp(7), chmod(7), touch(4)
    clearstatcache(7), mail(2), openlog(1), syslog(1), closelog(1)
    ob_start(17), ob_flush(3), ob_clean(1), ob_end_flush(1)
    ob_end_clean(12), ob_get_clean(2), ob_get_length(1)
    ob_get_contents(9), ksort(1), natsort(1), natcasesort(1)
    asort(5), arsort(1), sort(3), rsort(2), usort(2)
    uasort(2), shuffle(1), count(65), end(3), next(1)
    reset(7), current(3), key(14), min(6), max(8)
    in_array(33), array_search(10), extract(10)
    array_fill(4), range(3), array_multisort(1)
    array_push(10), array_pop(9), array_shift(63)
    array_unshift(5), array_splice(2), array_slice(7)
    array_merge(25), array_merge_recursive(1), array_keys(29)
    array_values(11), array_reverse(8), array_pad(2)
    array_flip(2), array_unique(5), array_intersect_key(1)
    array_diff(5), array_sum(4), array_filter(1)
    array_map(6), array_chunk(1), array_combine(2)
    array_key_exists(21), pos(1), sizeof(164), version_compare(14)
    sys_get_temp_dir(6)

Module sysvmsg ...

Module sysvsem ...

Module sysvshm ...

Module tokenizer ...

Module wddx ...

Module xml ...
    xml_parser_create(2), xml_set_object(1)
    xml_set_element_handler(1), xml_set_character_data_handler(1)
    xml_parse(1), xml_parse_into_struct(1)
    xml_parser_free(1), xml_parser_set_option(1)

Module xmlreader ...

Module xmlwriter ...

Module xsl ...

Module zlib ...
    gzencode(1), gzdecode(1)
cigamit commented 6 years ago

Great review @netniV! Updated.