session_start() fails when moving site

Need help installing Joomla! 3.x? For all Joomla! 3.x installation issues please use this forum.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Locked
bevco
Joomla! Intern
Joomla! Intern
Posts: 74
Joined: Fri Apr 09, 2010 4:17 pm

session_start() fails when moving site

Post by bevco » Thu Oct 11, 2018 10:51 pm

I am having the same problem when moving my site to GoDaddy. My error message is
PHP Warning: session_start(): Failed to read session data: user (path: /opt/alt/php72/var/lib/php/session) in /home/yugv8y3yjfjb/public_html/home/libraries/joomla/session/handler/native.php on line 260
I hope someone has an answer to this!

I have carefully checked my config file and database user and pwd are correct.
Last edited by toivo on Thu Oct 11, 2018 11:13 pm, edited 1 time in total.
Reason: mod note: split from someone else's topic - please create your own thread in the future
Bev
Mt Garfield Software

AWizard
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Oct 10, 2018 1:00 am

Re: session_start() fails

Post by AWizard » Thu Oct 11, 2018 11:09 pm

Hi Bevco, Apparently this can happen for a number of reasons including:
1. Headers already sent - which can happen if there is space or even an invisible character before the opening <?php of any php file called to this point. That can occur inadvertently when you transfer the files with FTP.
2. Not having the correct permissions on your PHP session directory. In your case /opt/alt/php72/var/lib/php/session/
There must also be other reasons because my test site is still not working but I have yet determind what they are. To verify that the above two reasons did not apply in my case I added the following code after line 261 in native.php:
echo session_save_path().":\r\n";
file_put_contents(session_save_path().'/test','Test');
$header = (headers_sent($file, $line)?"Header sent in file ".$file." on ".$line:"Header not sent");
This reports the path being used for session data and attepts to write a file to that location to confirm that permissions were OK. It then reports whether or not headers have been sent.
If you are prepared to do that then I'll see if I can resolve your issue. Otherwise, check the permissions first, that is the easiest step. ;)

bevco
Joomla! Intern
Joomla! Intern
Posts: 74
Joined: Fri Apr 09, 2010 4:17 pm

Re: session_start() fails when moving site

Post by bevco » Fri Oct 12, 2018 12:39 am

How do I get to the /opt/alt/php72/var/lib/php/session/ ?
Last edited by bevco on Fri Oct 12, 2018 12:47 am, edited 1 time in total.
Bev
Mt Garfield Software

AWizard
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Oct 10, 2018 1:00 am

Re: session_start() fails when moving site

Post by AWizard » Fri Oct 12, 2018 12:45 am

You need to sign in to your goDaddy account. Select your domain and then go to cPanel. From there you will see File Manager.

bevco
Joomla! Intern
Joomla! Intern
Posts: 74
Joined: Fri Apr 09, 2010 4:17 pm

Re: session_start() fails when moving site

Post by bevco » Fri Oct 12, 2018 12:48 am

OK I see the files but not an opt folder.
Bev
Mt Garfield Software

AWizard
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Oct 10, 2018 1:00 am

Re: session_start() fails when moving site

Post by AWizard » Fri Oct 12, 2018 12:51 am

I think you need to go to goDaddy support for more info on that.

bevco
Joomla! Intern
Joomla! Intern
Posts: 74
Joined: Fri Apr 09, 2010 4:17 pm

Re: session_start() fails when moving site

Post by bevco » Fri Oct 12, 2018 5:16 pm

Is this a folder in my website directory or something in GoDaddy?

Never mind - I think I found it!
Bev
Mt Garfield Software

bevco
Joomla! Intern
Joomla! Intern
Posts: 74
Joined: Fri Apr 09, 2010 4:17 pm

Re: session_start() fails when moving site

Post by bevco » Fri Oct 12, 2018 5:31 pm

I found the file /opt/alt/php72/var/lib/php/session/ and added the code but don't know where to find the report.
Bev
Mt Garfield Software

AWizard
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Oct 10, 2018 1:00 am

Re: session_start() fails when moving site

Post by AWizard » Fri Oct 12, 2018 11:06 pm

Hi Bev,
I am not sure what file you are looking for at /opt/alt/php72/var/lib/php/session/but to clarify from me:
You need to add the code to the native.php file after line 261. The path you are quoting is where the session data is stored and that is where a file called text containing the data "Text" whould be found if all access priviliges are correct.
Your native.php file is at:
/home/yugv8y3yjfjb/public_html/home/libraries/joomla/session/handler/native.php
The output will be embedded in the same error message that you were getting before and the test file should appear in whatever path was reported in that message.
Please post the full error message after you try the above.


Locked

Return to “Installation Joomla! 3.x”