• Resolved WebCodePoet

    (@senjoralfonso)


    session_start(): Failed to read session data: redis (path: unix:///var/run/redis/redis.sock?persistent=1&weight=1&database=16) in /wp-content/plugins/ninjafirewall/lib/utils.php on line 130"

    NinjaFirewall reads the & as an & I do not know why.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author nintechnet

    (@nintechnet)

    On line 130 of the ninjafirewall/lib/utils.php script, there’s just a call to the PHP session_start() start:

    128   if ( session_status() !== PHP_SESSION_ACTIVE ) {
    129      nfw_ini_set_cookie();
    130      session_start();
    131   }

    Could this be due to a misconfiguration in your PHP INI file?

    Thread Starter WebCodePoet

    (@senjoralfonso)

    Hey, I think that my INI is correct, here are the credentials:

    session.save_handler = redis
    session.save_path = “unix:///var/run/redis/redis.sock?persistent=1&weight=1&database=16”
    redis.session.locking_enabled = 1
    redis.session.lock_expire = 300
    redis.session.lock_wait_time = 50000
    redis.session.lock_retries = 2000
    session.use_strict_mode = 0
    session.use_cookies = 1
    session.use_only_cookies = 1
    session.name = PHPSESSID
    session.auto_start = 0
    session.cookie_lifetime = 0
    session.cookie_path = /

    Plugin Author nintechnet

    (@nintechnet)

    The path looks fine. The &? character comes from PHP when it throws the error.
    Try to run the following script:

    <?php
    if ( session_status() !== PHP_SESSION_ACTIVE ) {
    echo "Starting a session.";
    session_start();
    exit;
    }
    echo "A session is already active.";

    Save that to a “sessiontest.php” file, upload it in your WordPress root folder and visit https://your-site/sessiontest.php to see if it works or returns the same error.
    Don’t forget to disable the firewall before running the script.

    Thread Starter WebCodePoet

    (@senjoralfonso)

    Hey, the output is ‘Starting a session’. Independent of the state of the firewall or if I am logged in or not.

    Plugin Author nintechnet

    (@nintechnet)

    It seems to be working as expected.
    Do you see the error in your PHP log every time you access the site or randomly?

    Thread Starter WebCodePoet

    (@senjoralfonso)

    It is still: Warning: session_start(): Failed to read session data: redis (path: unix:///var/run/redis/redis.sock?persistent=1&weight=1&database=8) in?httpdocs/wp-content/plugins/ninjafirewall/lib/utils.php?on line?130

    Plugin Author nintechnet

    (@nintechnet)

    Log in to WordPress, go to NinjaFirewall > Dashboard: does it show that you are whitelisted ?

    Thread Starter WebCodePoet

    (@senjoralfonso)

    Hey, I finally fixed it with the helpf of the redis cache plugin developer. The error cames as I set the redis path correct in wp-config, but not in php.ini file.

    /var/run/redis/redis-server.sock
    /var/run/redis/redis.sock

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Problem with Session’ is closed to new replies.