• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Issue php session_start() causes website to hang and gateway timeout

morphoice

New Pleskian
Server operating system version
Debian 12
Plesk version and microupdate number
18.0.65 Update #2
I have a new plesk webserver setup with php version 8.2.24 by OS vendor run as FPM application.
php session.save_path is set to /var/lib/php/sessions which exists, however if I just so much as call sesssion_start()
in a php script the site hangs completely, eventually displaying a gateway timeout.What am I doing wrong?
it should be trivial to start a php session.
 
I tried the PHP script below.

Code:
<?php
echo "<pre>";
echo "PHP Version: " . phpversion() . "\n";
echo "Session Save Path: " . ini_get('session.save_path') . "\n";
try {
    if (session_status() !== PHP_SESSION_ACTIVE) {
         session_start();
         echo "Session started successfully.\n";
         $_SESSION['test_session_variable'] = "This is a test session variable.";
         echo "Test session variable set.\n";
         if (isset($_SESSION['test_session_variable'])) {
             echo "Session variable read successfully: " . $_SESSION['test_session_variable'] . "\n";
         }
    } else {
      echo "Session already started.\n";
    }
      $session_id = session_id();
      if(empty($session_id)){
        echo "Session id is blank. This means that we cannot create session files.\n";
      } else {
        echo "Session id: ".$session_id."\n";
      }
} catch (Exception $e) {
    echo "Error starting session: " . $e->getMessage() . "\n";
}
if(session_status() == PHP_SESSION_ACTIVE){
  echo "Session status is active. \n";
} else if (session_status() == PHP_SESSION_NONE){
    echo "Session status is none. \n";
} else if (session_status() == PHP_SESSION_DISABLED){
   echo "Session status is disabled. \n";
}
echo "</pre>";
?>

Even with the INCORRECT session.save_path the script doesn't hangs. Please see if this script the helps you to identify the issue is related to the session.save_path or not.
 
Back
Top