Page 1 of 1

HTTP Error 500

Posted: Tue Oct 26, 2021 8:38 pm
by manjotsc
Hi,

I am getting error 500 after the login page,

Code: Select all

10/26/21 16:36:58.720491 zmc_m3[259].ERR-zm_db.cpp/179 [Can't run query INSERT INTO `Logs` ( `TimeKey`, `Component`, `ServerId`, `Pid`, `Level`, `Code`, `Message`, `File`, `Line` ) VALUES ( 1635280618.720193, 'zmc_m3', 0, 255, 0, 'INF', 'Car: 900 - Capturing at 14.97 fps, capturing bandwidth 738964bytes/sec', 'zm_monitor.cpp', 1662 ): Tablespace is missing for table `zm`.`Logs`.]
Thanks,

Re: HTTP Error 500

Posted: Tue Oct 26, 2021 10:20 pm
by iconnor
Your logs table is missing.

You can recreate it using the definition in /usr/share/zoneminder/db/zm_create.sql

Re: HTTP Error 500

Posted: Mon Nov 01, 2021 7:50 am
by manjotsc
I getting this now,

Code: Select all

root@NVR:~# /usr/share/zoneminder/db/zm_create.sql
/usr/share/zoneminder/db/zm_create.sql: line 1: syntax error near unexpected token `('
/usr/share/zoneminder/db/zm_create.sql: line 1: `-- MySQL dump 10.13 Distrib 5.6.13, for Linux (i686)'
root@NVR:~# 

Re: HTTP Error 500

Posted: Mon Nov 01, 2021 10:11 am
by Magic919
This is the part referenced -

Code: Select all

--
-- Table structure for table `Logs`
--

DROP TABLE IF EXISTS `Logs`;
CREATE TABLE `Logs` (
  `Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `TimeKey` decimal(16,6) NOT NULL,
  `Component` varchar(32) NOT NULL,
  `ServerId` int(10) unsigned,
  `Pid` int(10) DEFAULT NULL,
  `Level` tinyint(3) NOT NULL,
  `Code` char(3) NOT NULL,
  `Message` text NOT NULL,
  `File` varchar(255) DEFAULT NULL,
  `Line` smallint(5) unsigned DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `TimeKey` (`TimeKey`)
) ENGINE=InnoDB;

CREATE INDEX `Logs_TimeKey_idx` ON `Logs` (`TimeKey`);
CREATE INDEX `Logs_Level_idx` ON `Logs` (`Level`);

Re: HTTP Error 500

Posted: Mon Nov 01, 2021 9:53 pm
by kitkat
You need to execute that file in MySQL rather than directly in a shell.

Try this, substituting your MySQL username in the obvious place (either the zm user or the root user):

Code: Select all

mysql -u USERNAME -p zm < zm_create.sql
Make sure that the input file contains only the definition for the logs table or else you might wipe out everything else, with no warning. Do not do it with the original file. Best bet is to copy the code you pasted, save it to a new file, and use that.

For general day-to-day SQL management phpMyAdmin is handy, and you could paste the table definition directly into that

Code: Select all

CREATE TABLE `zm`.`Logs` (
  `Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `TimeKey` decimal(16,6) NOT NULL,
  `Component` varchar(32) NOT NULL,
  `ServerId` int(10) unsigned,
  `Pid` int(10) DEFAULT NULL,
  `Level` tinyint(3) NOT NULL,
  `Code` char(3) NOT NULL,
  `Message` text NOT NULL,
  `File` varchar(255) DEFAULT NULL,
  `Line` smallint(5) unsigned DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `TimeKey` (`TimeKey`)
) ENGINE=InnoDB;

CREATE INDEX `Logs_TimeKey_idx` ON `Logs` (`TimeKey`);
CREATE INDEX `Logs_Level_idx` ON `Logs` (`Level`);

Re: HTTP Error 500

Posted: Wed Feb 01, 2023 4:54 pm
by STORTZ
You need to edit your the PHP time in the config file /etc/php.ini

I have a fresh install on CentOS 7.9 (2009) - followed all directions in the README.* to the T.. I went to the zoneminder URL page https://<url>/zm and boom, HTTP Error 500. /var/log/messages provided good details about timezone is not correct. Investigated further and eventhough Zoneminder states that the php.ini file is deprecated, I still took it upon myself to add the timezone in that file, instructions below:

vi /etc/php.ini

#Search for date.timezone in this file and add your system timezone to it, by default ZoneMinder uses UTC, my system is set to EST.
#uncomment the ; and add your timezone

;date.timezone =
date.timezone = EST

Save these changes and restart apache, web server

Hope this helps anyone with a CentOS install.