bobl61 Posted Thursday at 12:40 PM Share Posted Thursday at 12:40 PM I'm using a game stats processor called VSP stats which parses game logs and displays the output to a web page. The issue I'm having is that it stops processing the logs with the following error: PHP Fatal error: Uncaught Error: Undefined constant "LOG_READ_SIZE". The line of code that is causing the error: $seekResult = fseek($parser->logFileHandle, -LOG_READ_SIZE, SEEK_CUR); Server is on Windows 11 Apache 2.4.58 PHP 8.2.12. Quote Link to comment https://forums.phpfreaks.com/topic/327601-uncaught-error-undefined-constant/ Share on other sites More sharing options...
Suyadi Posted Thursday at 04:35 PM Share Posted Thursday at 04:35 PM (edited) That means it's not defined anywhere on that file so PHP can't find it. My suggestion would be to raise this issue to the developer of that script as the developer seems forgot to define that constant in their code. Those LOG_READ_SIZE constant used to set the offset of the fseek() and we don't know how big he set those number. my wild guess is as big as the log file size, so: defined('LOG_READ_SIZE') or define('LOG_READ_SIZE', filesize($logfilePath)); $seekResult = fseek($parser->logFileHandle, -LOG_READ_SIZE, SEEK_CUR); Edited Thursday at 04:35 PM by Suyadi Quote Link to comment https://forums.phpfreaks.com/topic/327601-uncaught-error-undefined-constant/#findComment-1653577 Share on other sites More sharing options...
gizmola Posted Thursday at 05:19 PM Share Posted Thursday at 05:19 PM Suyadi's comment is factually accurate. The code expects the constant value LOG_READ_SIZE, and it is not defined. WIth that said, often utility applications come with instructions on how they should be configured, it looks like this might be the case for the application. Check instructions and see if there is a configuration file that needs to exist in a particular place. Many applications are distributed with a file with default settings that needs to be copied and renamed. Quote Link to comment https://forums.phpfreaks.com/topic/327601-uncaught-error-undefined-constant/#findComment-1653578 Share on other sites More sharing options...
bobl61 Posted Thursday at 05:54 PM Author Share Posted Thursday at 05:54 PM (edited) There are a few different ways to process the stats based on what game and mod you are running. The one that is giving me the error is based on savestate 1 which continues from the last saved game log file. Savestate 0 runs without errors, but processes every game log file all over again every time. This is the from the batch file I use to tun the stats: C:\xampp\php\php.exe -f "C:\xampp\htdocs\q3eplus.servequake.com\vsp.php" -- -l q3a-xp -p savestate 1 "D:\Quake III Arena\excessiveplus\logs\server_mp.log" Edited Thursday at 05:55 PM by bobl61 Quote Link to comment https://forums.phpfreaks.com/topic/327601-uncaught-error-undefined-constant/#findComment-1653580 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.