Skip to content

Magento 2 SessionHandler is trying to read data from a directory belonging to a different cpanel account after duplicating account for a staging site

I followed the steps in this tutorial to duplicate a cPanel account containing our live Magento 2 site. I had to do this to retroactively create a staging site, as it would take months to set up a duplication of our production site.

Tutorial: https://bobcares.com/blog/cpanel-duplicate-account/

This process involved renaming the cPanel account which changed the database name and usernames, it changed the directory name, and I assume it changed the name in tons of other places as well. However somewhere I believe it forgot to change the username from the old ABC username, to the new ABCSTAGING username, and so it is still trying to access files from within our production account, which of course results in a permission denied error.

The solution would be to find what is causing this, instead of actually giving it permission, as of course we don’t want the staging site to do anything with our production site.

Here’s the full exception code:

Warning: SessionHandler::read(): open(/home/abc/tmp/sess_n8ii2c5ek61s7icaogcjckl087, O_RDWR) failed: Permission denied (13) in /home/abcstaging/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 22

Any advice or help will be greatly appreciated.