1

I am duplicating a Craft 3 site from a production environment to a dev environment (local with MAMP Pro). On the "new" dev site I can't log into the control panel. The credentials are valid but after getting the Craft spinner on the login screen it simply reloads.

Then any attempts to access any site page (front end or back end) give the dev mode error screen with a PHP warning: yii\base\ErrorException session_start(): open(/var/cpanel/php/sessions/ea-php72/sess_80tspb4u0b5129r9f87tlga18j, O_RDWR) failed: No such file or directory (2)

This is odd because my MAMP is running PHP 8.0 for this host. Production is also running PHP 8 (not the 7.2 shown in the filepath). It makes me wonder if there is some setting I am missing. I have tried deleting rows in the sessions table, deleting items in the runtime folder, clearing caches before creating a new files/database transfer... no luck.

In web.log there is yii\base\Exception: No user session token exists. I am not sure what other info might be helpful.

I am feeling sheepish to ask such a question but I am struggling and need a pointer.

Any ideas on what to try next?

3
  • Have you tried removing cookies for the domain in your browser, or trying logging in using another browser? Commented Oct 31, 2023 at 9:45
  • Try to delete the folder runtime under storage.
    – aodihis
    Commented Nov 1, 2023 at 1:57
  • @MartinSpain Thank you for those suggestions. I deleted the cookies and the result was that on page reload a new CraftSessionId was created, with the same session_start() error occurring. Same with another browser. Commented Nov 1, 2023 at 14:01

1 Answer 1

2

That session path is related to cPanel with an Easy Apache install with multiple php binaries.

For an error message to display that cPanel session path locally, there must be a session path hard-coded somewhere in the site config, perhaps in the .htaccess or a config file.

I would try searching the local project files for a piece of that string, for example, "ea-php72".

1
  • 2
    That's it! I did a search in my project's files for "ea-php72" and there was a php.ini and a user.ini file both with 'session.save_path = "/var/cpanel/php/sessions/ea-php72"'. I renamed both files so they wouldn't be loaded and now the site works as expected. I guess the production server created these files. Thanks, @colonelclick ! Commented Nov 1, 2023 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.