HTTP Error 500

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
manjotsc
Posts: 9
Joined: Sat Aug 15, 2020 11:16 am

HTTP Error 500

Post 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,
User avatar
iconnor
Posts: 2879
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: HTTP Error 500

Post by iconnor »

Your logs table is missing.

You can recreate it using the definition in /usr/share/zoneminder/db/zm_create.sql
manjotsc
Posts: 9
Joined: Sat Aug 15, 2020 11:16 am

Re: HTTP Error 500

Post 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:~# 
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: HTTP Error 500

Post 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`);
-
User avatar
kitkat
Posts: 193
Joined: Sun Jan 27, 2019 5:17 pm

Re: HTTP Error 500

Post 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`);
STORTZ
Posts: 2
Joined: Wed Feb 01, 2023 4:46 pm

Re: HTTP Error 500

Post 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.
Post Reply