Magento 2 – How to fix Exception SessionHandler

The Issue

You may face the following exception during the Magento 2 installation:

12345exception ‘Exception’ with message ‘Warning: SessionHandler::read(): open(..) failed: No such file or directory (2) ../magento2/lib/internal/Magento/Framework/Session/SaveHandler.php on line 74’ in ../magento2/lib/internal/Magento/Framework/App/ErrorHandler.php:67

The error occurs only in older code versions. To be more exact, you won’t see this exception working with versions from September 29, 2015, or later.

The Solution

The session.save_handler PHP parameter set to other session storages than files causes the issue. For instance, it can be set to redis or memcached. You can leverage one of the following two solutions to install Magento 2 successfully.

Upgrade

Since the problem is caused by the older code versions, you can upgrade it. To update the Magento 2 software:

  • Use the Component Manager or System Upgrade utilities if you installed the software from an archive or used ‘composer-create-project’
  • For contributing developers, there is another approach: Contributing developers—update, reinstall Magento.

For further information, read this material: Upgrade your Magento 2 code.

Existing Code

If you don’t want to upgrade the current code, it is also possible to use the following workaround. First of all, you have to locate php.ini. Use the following command:

1php -i | grep “Loaded Configuration File”

For Ubuntu, use /etc/php5/cli/php.ini

For CentOS, use /etc/php.ini

Log in as a user who has root privileges. Now, you can open the php.ini file in a text editor. You have to locate session.save_handler and set it. Use the following code to comment it out:

1;session.save_path = <path>

Set it to a file system path as follows:

1session.save_handler = files

That’s it. Now, you should fix the exception SessionHandler error during the Magento 2 installation.

Revisions

No comments yet.

Leave a Reply