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?
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 = /
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.
Hey, the output is ‘Starting a session’. Independent of the state of the firewall or if I am logged in or not.
It seems to be working as expected.
Do you see the error in your PHP log every time you access the site or randomly?
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
Log in to WordPress, go to NinjaFirewall > Dashboard: does it show that you are whitelisted ?
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