Permission error with PHP 8 and Session Handler

Dears, I`m refracting old php code 4 to php 8, but I'm having some errors on Session Control. I implementing a SessionHandlerInterface, but I still having error when execute session write

Warning: file_put_contents(../sessions/sess_fc6a0b26f218654ca0f45493861fdf58): failed to open stream: Arquivo ou diretório inexistente in /home/pedro/htdocs/ypanel/session.controller.php on line 36

Warning: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: ../sessions) in Unknown on line 0

I'm using Lampp with Mysql on Debian.

Here my class

    <?php
header('Content-Type: application/json');
//=========================================================================================
ini_set('session.save_path',realpath(dirname($_SERVER['DOCUMENT_ROOT']) . '/../session'));
//=========================================================================================
session_save_path("../sessions");
//=========================================================================================
error_reporting(2);
//=========================================================================================
class MySessionHandler implements SessionHandlerInterface
{
    private $savePath;

    public function open($savePath, $sessionName)
    {
        // printf(file_exists($savePath));
        // printf(is_dir($this->savePath).' dir');
        $this->savePath = $savePath;
        if (!is_dir($this->savePath)) 
        {
            chmod($this->savePath,0777);
            mkdir($this->savePath, 0777,true);
        }
        else printf('diretorio ja existe'); 
        return true;
    }

    public function close()
    {
        return true;
    }

    public function read($id)
    {
        return (string)@file_get_contents("$this->savePath/sess_$id");
    }

    public function write($id, $data)
    {
        return file_put_contents("$this->savePath/sess_$id", $data) === false ? false : true;
    }

    public function destroy($id)
    {
        $file = "$this->savePath/sess_$id";
        if (file_exists($file)) {
            unlink($file);
        }

        return true;
    }

    public function gc($maxlifetime)
    {
        foreach (glob("$this->savePath/sess_*") as $file) {
            if (filemtime($file) + $maxlifetime < time() && file_exists($file)) {
                unlink($file);
            }
        }

        return true;
    }
}

    $handler = new MySessionHandler();
    session_set_save_handler($handler, true);
    session_start();

    

?>