500 Error - session_start() No such file or directory

This error occurs infrequently, but it does happen on some servers. When you visit your website and it appears

It is not clear yet! Please open the laravel log file at /storage/logs. You will see an error message, for example:

[2020-11-25 15:52:59] local.ERROR: session_start(): open(/var/cpanel/php/sessions/ea-php72/sess_5dfc931c7c140c0bfda1d921a2d61023, O_RDWR) failed: No such file or directory (2) {"exception":"[object] (ErrorException(code: 0): session_start(): open(/var/cpanel/php/sessions/ea-php72/sess_5dfc931c7c140c0bfda1d921a2d61023, O_RDWR) failed: No such file or directory (2) at /home/.../public_html/../app/Http/Middleware/Locale.php:24)

How to fix the error?

  1. Open the file awebooking.php in the root directory of the project

  2. Add this line of code to the __construct () method.

public function __construct()
{
session_save_path(dirname(__FILE__)); // add this code
$this->_load('Hooks');
$this->_load('Abstracts');
$this->_load('Helpers');
$this->_load('Libraries');
$this->_load('Payments');
}

Watch the video below for more information