magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.58k stars 9.32k forks source link

Save session to redis error when configured on php level (Exception' with message 'Warning: SessionHandler::read()) #1735

Closed biotech closed 9 years ago

biotech commented 9 years ago

If php configured to save session on Redis instead of files - error below appear during the installation process. I use PHP 5.6 and https://github.com/phpredis/phpredis for store session in Redis, after change storage to files - everything works well. It looks like Magento not check if php session storage configured as files and trying to write sessions there. In my case this pretty confusing because i have configured like that

session.save_handler = redis session.save_path = "/tmp/redis.sock"

So save_patch in that case it's location of Redis socket and Magento trying to write sessions just around that which is for sure cause error. This can cause issue with any other session storage like Memcached etc. I suppose Magento should check session storage type during the installation before write there and maybe support Redis and Memcached by default or if it's not possible (?) - recommend set files as save_handler in php.

nbhjxzx4ogqs3pz9pvs2vpzwbwtecl5cx0pcgh8hfxo

Installing user configuration... [ERROR] exception 'Exception' with message 'Warning: SessionHandler::read(): open(/tmp/php-sessions/sess_sbiru6o2s28e3b0gq6v6hhlp83, O_RDWR) failed: No such file or directory (2) in /var/www/magento2demo.firebearstudio.com/magento2/lib/internal/Magento/Framework/Session/SaveHandler.php on line 74' in /var/www/magento2demo.firebearstudio.com/magento2/lib/internal/Magento/Framework/App/ErrorHandler.php:67 Stack trace: #0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'SessionHandler:...', '/var/www/magent...', 74, Array)

1 /var/www/magento2demo.firebearstudio.com/magento2/lib/internal/Magento/Framework/Session/SaveHandler.php(74): SessionHandler->read('sbiru6o2s28e3b0...')

2 [internal function]: Magento\Framework\Session\SaveHandler->read('sbiru6o2s28e3b0...')

3 /var/www/magento2demo.firebearstudio.com/magento2/lib/internal/Magento/Framework/Session/SessionManager.php(189): session_start()

mazhalai commented 9 years ago

@biotech thank you for reporting this error, we have created MAGETWO-42059 to track a fix for this.

piotrekkaminski commented 9 years ago

This was fixed and should be published soon.

biotech commented 9 years ago

Great job thanks !

magenx commented 7 years ago

in fact this error is still there

siliconalchemy commented 7 years ago

+1 still an issue

AndreiAghenii commented 6 years ago

Hello, I believe it is still an issue... Processing configurations data from configuration file... Import failed: Warning: SessionHandler::read(): open(${WEB_ROOT}/var/session/sess_cnkdti2mv2r35qc34n5qq2u5q6, O_RDWR) failed: No such file or directory (2) in /var/www/html/Magento2/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 PHP Fatal error: Uncaught Exception: Warning: SessionHandler::write(): open(${WEB_ROOT}/var/session/sess_cnkdti2mv2r35qc34n5qq2u5q6, O_RDWR) failed: No such file or directory (2) in /var/www/html/Magento2/vendor/magento/framework/Session/SaveHandler.php on line 105 in /var/www/html/Magento2/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace:

0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'SessionHandler:...', '/var/www/html/s...', 105, Array)

1 /var/www/html/Magento2/vendor/magento/framework/Session/SaveHandler.php(105): SessionHandler->write('cnkdti2mv2r35qc...', '')

2 [internal function]: Magento\Framework\Session\SaveHandler->write('cnkdti2mv2r35qc...', '')

3 {main}

thrown in /var/www/html/Magento2/vendor/magento/framework/App/ErrorHandler.php on line 61 Any help would be appreciated.

AndreiAghenii commented 6 years ago

Hey Guys, I fixed this issue, by providing correct path in php.ini:

'session' => array ( 'save' => 'files', 'save_path' => '/var/www/session', if directory does not exist please create one. ),

Hope this helps someone.