Autor Tópico: [Resolvido] HTTP ERROR 500 no OCS Inventory no Ubuntu Server  (Lida 283 vezes)

Offline fatecano

  • Usuário Ubuntu
  • *
  • Mensagens: 620
    • Ver perfil
[Resolvido] HTTP ERROR 500 no OCS Inventory no Ubuntu Server
« Online: 30 de Janeiro de 2021, 15:25 »
Senhores,

Estou com HTTP ERROR 500 no OCS Inventory ao acessar pelo browser.

Estou montando um laboratório no Virtual Box e utilizei esse tutorial abaixo para instalação no Ubuntu Server 20.04.02 LTS:

https://www.howtoforge.com/how-to-install-ocs-inventory-server-on-ubuntu-2004/

A instalação apresentou apenas um erro na dependência do PERL, que aparentemente que foi corrigido pelo comando cpan -f Archive::Zip.

Eu consegui chegar nessa tela:



Porém, ao clicar em "Click here to enter OCS-NG GUI", aparece esse erro:



Aparentemente o Apache está funcionando, pois aparece essa tela:



Esse tutorial mostra uma forma de corrigir o Erro 500:

https://www.joilsonlemos.com.br/ocs-inventory-com-o-erro-internal-server-error/

Segui todos os passos e continuo com o mesmo problema.

Alguém tem alguma sugestão?
« Última modificação: 02 de Fevereiro de 2021, 19:41 por fatecano »

Offline fatecano

  • Usuário Ubuntu
  • *
  • Mensagens: 620
    • Ver perfil
Re:HTTP ERROR 500 no OCS Inventory no Ubuntu Server
« Resposta #1 Online: 30 de Janeiro de 2021, 18:22 »
Segue o LOG dos erros do Apache:

Código: [Selecionar]
[Sat Jan 30 16:31:09.120653 2021] [php7:warn] [pid 77072] [client 192.168.0.86:64657] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, n>
24 [Sat Jan 30 16:31:17.373119 2021] [php7:warn] [pid 77068] [client 192.168.0.86:64663] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/a>
25 [Sat Jan 30 16:31:17.373139 2021] [php7:error] [pid 77068] [client 192.168.0.86:64663] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinve>
26 [Sat Jan 30 16:52:26.911452 2021] [mpm_prefork:notice] [pid 77067] AH00169: caught SIGTERM, shutting down
27 [Sat Jan 30 16:53:03.132399 2021] [mpm_prefork:notice] [pid 933] AH00163: Apache/2.4.41 (Ubuntu) mod_perl/2.0.11 Perl/v5.30.0 configured -- resuming normal operatio>
28 [Sat Jan 30 16:53:03.143460 2021] [core:notice] [pid 933] AH00094: Command line: '/usr/sbin/apache2'
29 [Sat Jan 30 16:53:35.544916 2021] [php7:warn] [pid 941] [client 192.168.0.86:64815] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/aut>
30 [Sat Jan 30 16:53:35.544958 2021] [php7:error] [pid 941] [client 192.168.0.86:64815] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinvent>
31 [Sat Jan 30 16:53:37.268535 2021] [php7:warn] [pid 942] [client 192.168.0.86:64817] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/aut>
32 [Sat Jan 30 16:53:37.268565 2021] [php7:error] [pid 942] [client 192.168.0.86:64817] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinvent>
33 [Sat Jan 30 16:53:49.240970 2021] [php7:warn] [pid 940] [client 192.168.0.86:64819] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/aut>
34 [Sat Jan 30 16:53:49.241025 2021] [php7:error] [pid 940] [client 192.168.0.86:64819] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinvent>
35 [Sat Jan 30 17:00:39.904929 2021] [php7:warn] [pid 943] [client 192.168.0.86:64878] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/aut>
36 [Sat Jan 30 17:00:39.904962 2021] [php7:error] [pid 943] [client 192.168.0.86:64878] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinvent>
37 [Sat Jan 30 17:03:11.410301 2021] [php7:warn] [pid 941] [client 192.168.0.86:64888] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/aut>
38 [Sat Jan 30 17:03:11.410328 2021] [php7:error] [pid 941] [client 192.168.0.86:64888] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinvent>
39 [Sat Jan 30 17:03:12.174534 2021] [php7:warn] [pid 942] [client 192.168.0.86:64889] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/aut>
40 [Sat Jan 30 17:03:12.174555 2021] [php7:error] [pid 942] [client 192.168.0.86:64889] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinvent>
41 [Sat Jan 30 17:16:30.253611 2021] [php7:warn] [pid 940] [client 192.168.0.86:65023] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/aut>
42 [Sat Jan 30 17:16:30.253635 2021] [php7:error] [pid 940] [client 192.168.0.86:65023] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinvent>
43 [Sat Jan 30 17:40:37.081281 2021] [php7:warn] [pid 1116] [client 192.168.0.86:65181] PHP Warning:  mysqli_real_escape_string() expects parameter 1 to be mysqli, nul>
44 [Sat Jan 30 17:40:37.081331 2021] [php7:warn] [pid 1116] [client 192.168.0.86:65181] PHP Warning:  mysqli_query() expects parameter 1 to be mysqli, null given in /u>
45 [Sat Jan 30 17:40:37.081341 2021] [php7:warn] [pid 1116] [client 192.168.0.86:65181] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, nu>
46 [Sat Jan 30 17:40:39.927034 2021] [php7:warn] [pid 941] [client 192.168.0.86:65183] PHP Warning:  mysqli_real_escape_string() expects parameter 1 to be mysqli, null>
47 [Sat Jan 30 17:40:39.927055 2021] [php7:warn] [pid 941] [client 192.168.0.86:65183] PHP Warning:  mysqli_query() expects parameter 1 to be mysqli, null given in /us>
48 [Sat Jan 30 17:40:39.927064 2021] [php7:warn] [pid 941] [client 192.168.0.86:65183] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, nul>
49 [Sat Jan 30 18:03:15.846555 2021] [php7:warn] [pid 1272] [client 192.168.0.86:65506] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/au>
50 [Sat Jan 30 18:03:15.846588 2021] [php7:error] [pid 1272] [client 192.168.0.86:65506] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinven>
51 [Sat Jan 30 20:49:35.721455 2021] [mpm_prefork:notice] [pid 933] AH00169: caught SIGTERM, shutting down
52 [Sat Jan 30 21:10:49.839494 2021] [mpm_prefork:notice] [pid 964] AH00163: Apache/2.4.41 (Ubuntu) mod_perl/2.0.11 Perl/v5.30.0 configured -- resuming normal operatio>
53 [Sat Jan 30 21:10:49.889420 2021] [core:notice] [pid 964] AH00094: Command line: '/usr/sbin/apache2'
54 [Sat Jan 30 21:12:49.771871 2021] [php7:warn] [pid 981] [client 192.168.0.86:50393] PHP Warning:  mysqli_real_escape_string() expects parameter 1 to be mysqli, null>
55 [Sat Jan 30 21:12:49.771920 2021] [php7:warn] [pid 981] [client 192.168.0.86:50393] PHP Warning:  mysqli_query() expects parameter 1 to be mysqli, null given in /us>
56 [Sat Jan 30 21:12:49.771930 2021] [php7:warn] [pid 981] [client 192.168.0.86:50393] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, nul>
57 [Sat Jan 30 21:12:56.200230 2021] [php7:warn] [pid 1155] [client 192.168.0.86:50400] PHP Warning:  mysqli_real_escape_string() expects parameter 1 to be mysqli, nul>
58 [Sat Jan 30 21:12:56.200267 2021] [php7:warn] [pid 1155] [client 192.168.0.86:50400] PHP Warning:  mysqli_query() expects parameter 1 to be mysqli, null given in /u>
59 [Sat Jan 30 21:12:56.200279 2021] [php7:warn] [pid 1155] [client 192.168.0.86:50400] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, nu>
60 [Sat Jan 30 21:12:59.849360 2021] [php7:warn] [pid 1155] [client 192.168.0.86:50400] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/au>
61 [Sat Jan 30 21:12:59.849392 2021] [php7:error] [pid 1155] [client 192.168.0.86:50400] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinven>
62

Percebi que essa pasta /usr/share/ocsinventory-reports/ocsreports/vendor/au não existe.

Só existe até ocsreports.

O OCS tem uma pasta de LOGs também, mas está vazia.

Estou pesquisando e se achar uma resposta, postarei aqui.

Offline selvaking

  • Equipe Ubuntu
  • Usuário Ubuntu
  • *****
  • Mensagens: 1.147
  • Parque Anchieta - Rio de Janeiro - RJ
    • Ver perfil
Re:HTTP ERROR 500 no OCS Inventory no Ubuntu Server
« Resposta #2 Online: 31 de Janeiro de 2021, 14:12 »
Vc viu esse aviso?

Citar
WARNING: if you change default database (ocsweb) or user (ocs), don't forget to update the file 'z-ocsinvetory.conf' in your Apache configuration directory.

AVISO: se você alterar o banco de dados padrão (ocsweb) ou usuário (ocs), não se esqueça de atualizar o arquivo 'z-ocsinvetory.conf' no diretório de configuração do Apache.

Vc fez a atualização desse arquivo do nome do banco de dados e do usuário?
Dê-me um computador com o Tux que movo o mundo!

Linux User #323049

Offline fatecano

  • Usuário Ubuntu
  • *
  • Mensagens: 620
    • Ver perfil
Re:HTTP ERROR 500 no OCS Inventory no Ubuntu Server
« Resposta #3 Online: 31 de Janeiro de 2021, 23:25 »
Vc viu esse aviso?

Citar
WARNING: if you change default database (ocsweb) or user (ocs), don't forget to update the file 'z-ocsinvetory.conf' in your Apache configuration directory.

Sendo bem honesto, eu não tinha reparado que estavam diferentes.

Usei os nomes que o tutorial havia sugerido e, nas demais tentativas, mudei apenas o usuário e senha para "ocs" em ambos.

Citar
Vc fez a atualização desse arquivo do nome do banco de dados e do usuário?

Excluí o banco de dados e o usuário, criando um novo com a senha "ocs".

Ficou assim:





Atribuí essa permissão ao usuário:

Código: [Selecionar]
GRANT ALL ON ocsweb.* TO 'ocs'@'localhost' WITH GRANT OPTION;
O "z-ocsinventory-server.conf" ficou assim:

Código: [Selecionar]
  GNU nano 4.8                                                           z-ocsinventory-server.conf
################################################################################
#
# OCS Inventory NG Communication Server Perl Module Setup
#
# Copyleft 2006 Pascal DANEK
# Web: http://www.ocsinventory-ng.org
#
# This code is open source and may be copied and modified as long as the source
# code is always made freely available.
# Please refer to the General Public Licence http://www.gnu.org/ or Licence.txt
################################################################################

<IfModule mod_perl.c>

  # Which version of mod_perl we are using
  # For mod_perl <= 1.999_21, replace 2 by 1
  # For mod_perl > 1.999_21, replace 2 by 2
  PerlSetEnv OCS_MODPERL_VERSION 2

  # Master Database settings
  # Replace localhost by hostname or ip of MySQL server for WRITE
  PerlSetEnv OCS_DB_HOST localhost
  # Replace 3306 by port where running MySQL server, generally 3306
  PerlSetEnv OCS_DB_PORT 3306
  # Name of database
  PerlSetEnv OCS_DB_NAME ocsweb
  PerlSetEnv OCS_DB_LOCAL ocsweb
  # User allowed to connect to database
  PerlSetEnv OCS_DB_USER ocs
  # Password for user
  PerlSetVar OCS_DB_PWD ocs
  # SSL Configuration
  # 0 to disable the SSL support for MySQL/MariaDB
  # 1 to enable the SSL support for MySQL/MariaDB
  PerlSetEnv OCS_DB_SSL_ENABLED 0
  # PerlSetEnv OCS_DB_SSL_CLIENT_KEY /etc/ssl/private/client.key
  # PerlSetEnv OCS_DB_SSL_CLIENT_CERT /etc/ssl/certs/client.crt
  # PerlSetEnv OCS_DB_SSL_CA_CERT /etc/ssl/certs/ca.crt
  # SSL Mode
  # - SSL_MODE_PREFERRED (SSL enabled but optional)

Logs do Apache:

Código: [Selecionar]
[Mon Feb 01 01:05:08.112428 2021] [mpm_prefork:notice] [pid 1006] AH00163: Apache/2.4.41 (Ubuntu) mod_perl/2.0.11 Perl/v5.30.0 configured -- resuming normal operations
[Mon Feb 01 01:05:08.134362 2021] [core:notice] [pid 1006] AH00094: Command line: '/usr/sbin/apache2'
[Mon Feb 01 01:30:12.841749 2021] [mpm_prefork:notice] [pid 1006] AH00169: caught SIGTERM, shutting down
[Mon Feb 01 01:30:13.335309 2021] [mpm_prefork:notice] [pid 13640] AH00163: Apache/2.4.41 (Ubuntu) mod_perl/2.0.11 Perl/v5.30.0 configured -- resuming normal operations
[Mon Feb 01 01:30:13.335357 2021] [core:notice] [pid 13640] AH00094: Command line: '/usr/sbin/apache2'
[Mon Feb 01 01:30:30.584054 2021] [php7:warn] [pid 13642] [client 192.168.0.86:57516] PHP Warning:  mysqli_real_escape_string() expects parameter 1 to be mysqli, null >
[Mon Feb 01 01:30:30.584101 2021] [php7:warn] [pid 13642] [client 192.168.0.86:57516] PHP Warning:  mysqli_query() expects parameter 1 to be mysqli, null given in /usr>
[Mon Feb 01 01:30:30.584110 2021] [php7:warn] [pid 13642] [client 192.168.0.86:57516] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, null>
[Mon Feb 01 01:30:56.422782 2021] [php7:warn] [pid 13643] [client 192.168.0.86:57520] PHP Warning:  mysqli_real_escape_string() expects parameter 1 to be mysqli, null >
[Mon Feb 01 01:30:56.422814 2021] [php7:warn] [pid 13643] [client 192.168.0.86:57520] PHP Warning:  mysqli_query() expects parameter 1 to be mysqli, null given in /usr>
[Mon Feb 01 01:30:56.422823 2021] [php7:warn] [pid 13643] [client 192.168.0.86:57520] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, null>
[Mon Feb 01 01:30:56.494390 2021] [php7:warn] [pid 13643] [client 192.168.0.86:57520] PHP Warning:  mysqli_fetch_object() expects parameter 1 to be mysqli_result, bool>
[Mon Feb 01 01:31:03.802795 2021] [php7:warn] [pid 13643] [client 192.168.0.86:57520] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/auto>
[Mon Feb 01 01:31:03.802822 2021] [php7:error] [pid 13643] [client 192.168.0.86:57520] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinvento>
[Mon Feb 01 01:51:17.387697 2021] [mpm_prefork:notice] [pid 13640] AH00169: caught SIGTERM, shutting down
[Mon Feb 01 01:51:53.159979 2021] [mpm_prefork:notice] [pid 932] AH00163: Apache/2.4.41 (Ubuntu) mod_perl/2.0.11 Perl/v5.30.0 configured -- resuming normal operations
[Mon Feb 01 01:51:53.166427 2021] [core:notice] [pid 932] AH00094: Command line: '/usr/sbin/apache2'
[Mon Feb 01 01:57:30.266724 2021] [php7:warn] [pid 956] [client 192.168.0.86:57762] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/autolo>
[Mon Feb 01 01:57:30.266986 2021] [php7:error] [pid 956] [client 192.168.0.86:57762] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinventory>
[Mon Feb 01 01:57:32.638104 2021] [php7:warn] [pid 957] [client 192.168.0.86:57765] PHP Warning:  require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/autolo>
[Mon Feb 01 01:57:32.638143 2021] [php7:error] [pid 957] [client 192.168.0.86:57765] PHP Fatal error:  require_once(): Failed opening required '/usr/share/ocsinventory>

Vou fazer essa instalação totalmente do zero novamente.

Devo estar vacilando em algum detalhe.

Offline fatecano

  • Usuário Ubuntu
  • *
  • Mensagens: 620
    • Ver perfil
Re:HTTP ERROR 500 no OCS Inventory no Ubuntu Server
« Resposta #4 Online: 02 de Fevereiro de 2021, 19:40 »
Senhores,

Utilizei esse outro tutorial e funcionou:

https://www.youtube.com/watch?v=cYncvlI7tVI&t=309s&ab_channel=HappyGhost

Ele tem algumas etapas diferentes e não sei qual delas fez funcionar.

Mas o importante é que está rodando.