Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

PHP session id issues with InterAkt KT functions

I'm working on an old website that was made in the early 2000s. It has a lot of errors, but mostly fixable. I was receiving an error, "Your session is incorrectly defined and cannot be started. Check your php.ini configuration." . I was able to deduce that this is an error coming from a php page called KT_functions.inc.php which I believe is provided from InterAkt Online in their 'Includes' package.

I found the very same error on that page in this function :

function KT_session_start() {
    if (!session_id()) {
        @session_start();
        if (!session_id()) {
            die('Your session is incorrectly defined and cannot be started. Check your php.ini configuration.');
        }
    }
    
    $siteroot = md5(KT_getSiteRoot());
    if ( isset($_SESSION[$siteroot]) && is_array($_SESSION[$siteroot]) ) {
        foreach ($_SESSION[$siteroot] as $key => $value) {
            $_SESSION[$key] = $value;
        }
    }
}

After a while of trying to resolve the error I (naively) tried to just comment it out. Now all of the web pages return Error 500. This was a core function to the website, so pretty much every page used it.

I realize that this is one function in a much larger set, and this may not be enough information. I've contacted the company for help to no avail. I'm just looking for some direction.

Edit : Here are the php.ini configurations

display_errors = On
max_execution_time = 30
max_input_time = 60
max_input_vars = 1000
memory_limit = 32M
post_max_size = 8M
session.gc_maxlifetime = 1440
session.save_path = "/var/cpanel/php/sessions/ea-php72"
upload_max_filesize = 2M
zlib.output_compression = Off

Edit 2 : I fixed the issue by enabling display_errors and finding where the error was. I had updated the PHP version previously as well and I believe a piece of a different code wasn't working as it was deprecated.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...