mbolli / nfsen-ng

Responsive NetFlow visualizer built on top of nfdump tools.
Apache License 2.0
231 stars 43 forks source link

Error : `PHP Fatal error: Uncaught Error: Class "mbolli\nfsen_ng\common\Debug" not found in /var/www/html/nfsen-ng/backend/cli.php:9` when trying to run `cli.php` #99

Closed FontouraAbreu closed 6 months ago

FontouraAbreu commented 6 months ago

When trying to run /var/www/html/nfsen-ng/backend/cli.php start I get:

PHP Warning:  include_once(/var/www/html/nfsen-ng/backend/../vendor/autoload.php): Failed to open stream: No such file or directory in /var/www/html/nfsen-ng/backend/cli.php on line 3
PHP Warning:  include_once(): Failed opening '/var/www/html/nfsen-ng/backend/../vendor/autoload.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/nfsen-ng/backend/cli.php on line 3
PHP Fatal error:  Uncaught Error: Class "mbolli\nfsen_ng\common\Debug" not found in /var/www/html/nfsen-ng/backend/cli.php:9
Stack trace:
#0 {main}
  thrown in /var/www/html/nfsen-ng/backend/cli.php on line 9

This comes from the branch prep-php-82


My current php version is:

root@nfsen-ng:/var/www/html/nfsen-ng/backend# php -v
PHP 8.2.7 (cli) (built: Jun  9 2023 19:37:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies

When I tried to run composer install --no-dev as indicated on https://github.com/mbolli/nfsen-ng/tree/prep-php-82?tab=readme-ov-file#installation I got:

Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - Root composer.json requires PHP extension ext-mbstring * but it is missing from your system. Install or enable PHP's mbstring extension.

To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/8.2/cli/php.ini
    - /etc/php/8.2/cli/conf.d/10-opcache.ini
    - /etc/php/8.2/cli/conf.d/10-pdo.ini
    - /etc/php/8.2/cli/conf.d/15-xml.ini
    - /etc/php/8.2/cli/conf.d/20-calendar.ini
    - /etc/php/8.2/cli/conf.d/20-ctype.ini
    - /etc/php/8.2/cli/conf.d/20-dom.ini
    - /etc/php/8.2/cli/conf.d/20-exif.ini
    - /etc/php/8.2/cli/conf.d/20-ffi.ini
    - /etc/php/8.2/cli/conf.d/20-fileinfo.ini
    - /etc/php/8.2/cli/conf.d/20-ftp.ini
    - /etc/php/8.2/cli/conf.d/20-gettext.ini
    - /etc/php/8.2/cli/conf.d/20-iconv.ini
    - /etc/php/8.2/cli/conf.d/20-phar.ini
    - /etc/php/8.2/cli/conf.d/20-posix.ini
    - /etc/php/8.2/cli/conf.d/20-readline.ini
    - /etc/php/8.2/cli/conf.d/20-rrd.ini
    - /etc/php/8.2/cli/conf.d/20-shmop.ini
    - /etc/php/8.2/cli/conf.d/20-simplexml.ini
    - /etc/php/8.2/cli/conf.d/20-sockets.ini
    - /etc/php/8.2/cli/conf.d/20-sysvmsg.ini
    - /etc/php/8.2/cli/conf.d/20-sysvsem.ini
    - /etc/php/8.2/cli/conf.d/20-sysvshm.ini
    - /etc/php/8.2/cli/conf.d/20-tokenizer.ini
    - /etc/php/8.2/cli/conf.d/20-xmlreader.ini
    - /etc/php/8.2/cli/conf.d/20-xmlwriter.ini
    - /etc/php/8.2/cli/conf.d/20-xsl.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-mbstring` to temporarily ignore these required extensions.

I don't know if the problem with mbstring might be the cause but running composer update takes too much time and returns a timeout error:

The following exception is caused by a process timeout
Check https://getcomposer.org/doc/06-config.md#process-timeout for details

In Process.php line 1204:

  The process "git clone --mirror -- 'https://github.com/phpstan/phpstan.git' '/  
  root/.cache/composer/vcs/https---github.com-phpstan-phpstan.git/'" exceeded th  
  e timeout of 300 seconds.    
FontouraAbreu commented 6 months ago

After running composer install --no-dev --ignore-platform-req=ext-mbstring I was able to run ./cli.php start without errors

root@nfsen-ng:/var/www/html/nfsen-ng/backend# ./cli.php start
2024-02-21 17:30:29 CLI: Starting daemon...
int(0)
Daemon running, pid=1525

This issue can be closed, I hope it helps anyone facing the same problem.

mbolli commented 6 months ago

@FontouraAbreu to install mbstring just make an apt install php-mbstring and then phpenmod mbstring.