cancel
Showing results for 
Search instead for 
Did you mean: 

Migrated M2 to Dev Server - SessionHandler Error

Migrated M2 to Dev Server - SessionHandler Error

Hi guys, 

 

I wondered if anyone could shed some light on an issue i'm having. 

 

Both the live site & dev. sight are on the same VPS. 

 

Our hosting company migrated the live live site onto out development instance so i can make some updates & test some new extensions along with maintenance. 

 

This is what i'm facing. I think it may be a permissions issue but could be wrong. 

 

Exception: Warning: SessionHandler::read(): open(/var/cpanel/php/sessions/ea-php71/sess_9dbdae95d73fd32da7e6b31a7868ee8a, O_RDWR) failed: Permission denied (13) in /home/MAGENTO ROOT/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22 in /home/MAGENTO ROOT/public_html/vendor/magento/framework/App/ErrorHandler.php:61 
Stack trace: 
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'SessionHandler:...', '/home/devproaud...', 22, Array) 
#1 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Session/SaveHandler/Native.php(22): SessionHandler->read('9dbdae95d73fd32...') 
#2 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Session/SaveHandler.php(80): Magento\Framework\Session\SaveHandler\Native->read('9dbdae95d73fd32...') 
#3 [internal function]: Magento\Framework\Session\SaveHandler->read('9dbdae95d73fd32...') 
#4 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Session/SessionManager.php(206): session_start() 
#5 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\Session\SessionManager->start() #6 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Session\Generic\Interceptor->___callParent('start', Array) 
#7 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\Session\Generic\Interceptor->Magento\Framework\Interception\{closure}() 
#8 /home/MAGENTO ROOT/public_html/generated/code/Magento/Framework/Session/Generic/Interceptor.php(52): Magento\Framework\Session\Generic\Interceptor->___callPlugins('start', Array, Array) 
#9 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Session/SessionManager.php(140): Magento\Framework\Session\Generic\Interceptor->start() 
#10 /home/MAGENTO ROOT/public_html/generated/code/Magento/Framework/Session/Generic/Interceptor.php(14): Magento\Framework\Session\SessionManager->__construct(Object(Magento\Framework\App\Request\Http), Object(Magento\Framework\Session\SidResolver\Proxy), Object(Magento\Framework\Session\Config), Object(Magento\Framework\Session\SaveHandler), Object(Magento\Framework\Session\Validator), Object(Magento\Framework\Session\Storage), Object(Magento\Framework\Stdlib\Cookie\PhpCookieManager), Object(Magento\Framework\Stdlib\Cookie\CookieMetadataFactory), Object(Magento\Framework\App\State\Interceptor), NULL) 
#11 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(116): Magento\Framework\Session\Generic\Interceptor->__construct(Object(Magento\Framework\App\Request\Http), Object(Magento\Framework\Session\SidResolver\Proxy), Object(Magento\Framework\Session\Config), Object(Magento\Framework\Session\SaveHandler), Object(Magento\Framework\Session\Validator), Object(Magento\Framework\Session\Storage), Object(Magento\Framework\Stdlib\Cookie\PhpCookieManager), Object(Magento\Framework\Stdlib\Cookie\CookieMetadataFactory), Object(Magento\Framework\App\State\Interceptor), NULL) 
#12 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array) 
#13 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...') 
#14 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(160): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framewo...') 
#15 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(246): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Framewo...', NULL, 'session', 'Magento\\Custome...') 
#16 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\Custome...', Array, Array) 
#17 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Custome...', Array, Array) 
#18 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Custome...') 
#19 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(160): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Custome...') 
#20 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(246): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Custome...', NULL, 'customerSession', 'Magento\\Checkou...') 
#21 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\Checkou...', Array, Array) 
#22 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Checkou...', Array, Array) 
#23 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Checkou...') 
#24 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(160): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Checkou...') 
#25 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(246): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Checkou...', NULL, 'checkoutSession', 'Magento\\Persist...') 
#26 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\Persist...', Array, Array) 
#27 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Persist...', Array, Array) 
#28 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Persist...') 
#29 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(160): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Persist...') 
#30 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(246): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Persist...', NULL, 'persistentSessi...', 'Magento\\Persist...') 
#31 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\Persist...', Array, Array) 
#32 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Persist...', Array, Array) 
#33 /home/MAGENTO ROOT/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Persist...') 
#34 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/PluginList/PluginList.php(250): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Persist...') 
#35 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/Interceptor.php(119): Magento\Framework\Interception\PluginList\PluginList->getPlugin('Magento\\Framewo...', 'persistent_page...') 
#36 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Context\Interceptor->Magento\Framework\Interception\{closure}() 
#37 /home/MAGENTO ROOT/public_html/generated/code/Magento/Framework/App/Http/Context/Interceptor.php(78): Magento\Framework\App\Http\Context\Interceptor->___callPlugins('getVaryString', Array, Array) 
#38 /home/MAGENTO ROOT/public_html/vendor/magento/framework/App/Response/Http.php(102): Magento\Framework\App\Http\Context\Interceptor->getVaryString() 
#39 /home/MAGENTO ROOT/public_html/generated/code/Magento/Framework/App/Response/Http/Interceptor.php(37): Magento\Framework\App\Response\Http->sendVary() 
#40 /home/MAGENTO ROOT/public_html/vendor/magento/module-page-cache/Model/App/Response/HttpPlugin.php(25): Magento\Framework\App\Response\Http\Interceptor->sendVary() 
#41 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/Interceptor.php(121): Magento\PageCache\Model\App\Response\HttpPlugin->beforeSendResponse(Object(Magento\Framework\App\Response\Http\Interceptor)) 
#42 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Response\Http\Interceptor->Magento\Framework\Interception\{closure}() 
#43 /home/MAGENTO ROOT/public_html/generated/code/Magento/Framework/App/Response/Http/Interceptor.php(117): Magento\Framework\App\Response\Http\Interceptor->___callPlugins('sendResponse', Array, Array) 
#44 /home/MAGENTO ROOT/public_html/vendor/magento/framework/App/Http.php(186): Magento\Framework\App\Response\Http\Interceptor->sendResponse() 
#45 /home/MAGENTO ROOT/public_html/vendor/magento/framework/App/Http.php(157): Magento\Framework\App\Http->handleDeveloperMode(Object(Magento\Framework\App\Bootstrap), Object(Exception)) 
#46 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Http->catchException(Object(Magento\Framework\App\Bootstrap), Object(Exception)) 
#47 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor->___callParent('catchException', Array) 
#48 /home/MAGENTO ROOT/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Bootstrap), Object(Exception)) 
#49 /home/MAGENTO ROOT/public_html/generated/code/Magento/Framework/App/Http/Interceptor.php(39): Magento\Framework\App\Http\Interceptor->___callPlugins('catchException', Array, Array) 
#50 /home/MAGENTO ROOT/public_html/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->catchException(Object(Magento\Framework\App\Bootstrap), Object(Exception)) 
#51 /home/MAGENTO ROOT/public_html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor)) 
#52 {main}

I don't have access to "/var/cpanel/php/sessions/ea-php71/"  as it is on the root level of the server & have sent a ticket to my hosting company. 

 

Any help would be appreciated. 


Thank you

2 REPLIES 2

Re: Migrated M2 to Dev Server - SessionHandler Error

Hello @jake_brown 

 

It seems issue with your files and folder permission, 

You need to set 775 for folders and subfolders and 664 for all type of files, and you should give 777 permission to var/ generated/ pub/static/ pub/media/

so you must run below commands to set permissions : 

find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \; && chmod u+x bin/magento
chmod 777 -R var/ generated/ pub/static/ pub/media/

and after installing it may require permission for env.php file:

chmod 777 app/etc/env.php

It may help you to resolve above error, let me know if still error persist.

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Migrated M2 to Dev Server - SessionHandler Error

Looks like the permissions you have on the PHP sessions directory are incorrect.

If this is a VPS you simple need to update the permissions on this folder and it should start working:

/var/cpanel/php/sessions/ea-php71/


I've checked a cPanel install I have access to and the permissions for the global php sessions folder are:

drwx-wx-wt 2 root root

Note the "t" on the end is a sticky bit so if that is missing your cPanel users won't have access to write there.

--
Problem solved? Click Accept as Solution!