Why is the session being deleted after approximately 30 minutes despite setting the session lifetime to 8 hours?

The issue may be caused by the server's session garbage collection settings, which could be configured to delete inactive sessions after a certain period. To resolve this, you can adjust the session.gc_maxlifetime setting in your php.ini file to match the desired session lifetime.

// Set the session lifetime to 8 hours (28800 seconds)
ini_set('session.gc_maxlifetime', 28800);
session_set_cookie_params(28800);
session_start();