How to fix Exception SessionHandler during Magento 2 installation

- Fire development, Magento 2

Magento 2 export CLI

The Exception SessionHandler error may disrupt the last step of the Magento 2 installation. However, you can quickly fix it, regaining control over the procedure and installing Magento 2 successfully. Below, we describe when and why the error occurs and how to fix it. More useful tips are available in our Developer’s Cookbook.

The Issue

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

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:

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:

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:

Set it to a file system path as follows:

That’s it. Now, you should fix the exception SessionHandler error during the Magento 2 installation. If you still have questions, read this material: During installation, exception SessionHandler::read().