"unable to write session data" during install and admin switches to IP address

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
thetallguy

"unable to write session data" during install and admin switches to IP address

Post by thetallguy »

I'm having trouble installing CMSMS on a new ISP.  After copying the CMSMS folders up to the site, setting folder permissions, and initializing the database, install.php gets weird starting at step 2.

While the main text on the page looks correct, at the bottom in green it says:

Warning: Unknown(): open(/tmp/php-ses/sess_f89eb6f615c0729e7171c485562aff0a, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp/php-ses) in Unknown on line 0

It's like the tmp folder isn't writeable, except that all four folders that are supposed to be 777 seem to be.  (And the config file is 666.)  And in step 1, the messages indicated that the folders that needed to be writable were.

With the exception of these messages, however, the install proceeds normally.  On each subsequent page, the same error appears, even on the last "success!" page.  When I view the main site after install, I do NOT get the messages. But when I switch to admin, the login screen gets the messages again. 

And, when I enter the admin login info and click Submit, the URL switches from the normal domain name to an IP address.  Since I have a shared host, IP addresses by themselves don't work.

Possible clue: In the last page of the Install (step 4) the CMS Document Root defaults to an IP address, not the domain name.  I have to manually edit it to make it a domain name instead.

Lastly, checking the config.php file, I see that it has only domain names in it, no IP addresses.  So the IP address that comes up after admin login is NOT coming from the config.php file.

Has anyone encountered this problem before?

Thanks in advance for any help!
Michael
thetallguy

Re: "unable to write session data" during install and admin switches to IP addre

Post by thetallguy »

And a follow-up...  I set debug to true, and now the admin page doesn't redirect.  Instead, it shows what seem to be two redirection pages, and then dumps me back at the login page again.  At no point does it route me to an IP address.

The debug statements don't seem to shed any light on why those "failure to write" messages appear.

Michael
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: "unable to write session data" during install and admin switches to IP address

Post by Ted »

Well, the tmp directory that the sessions are referring to is not the one in CMSMS, but instead the system's tmp directory.  This is most likely a server misconfiguration, because /tmp should always be 777 on any unix system.
thetallguy

Re: "unable to write session data" during install and admin switches to IP addre

Post by thetallguy »

Yes, as it turns out, it *IS* a server issue.  My ISP uses a clustered server configuration, so all the normal "local" directories are locked down, since each incoming transaction could be handled by any one of the servers within the cluster.  Therefore, I need to override the standard PHP temp folder with a specific one in my document root. 

A quick "search all" of the CMS tree doesn't turn up any "session_save_path" function within the code.  Any suggestions on where I should add one?  I'd guess I'd also need to add something to the config file to specify the override path, though I probably don't need to alter any *old* code to handle that.

Thanks for the help!
Michael
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: "unable to write session data" during install and admin switches to IP address

Post by Ted »

Assuming you have .htaccess available to you, you should be able to do

Code: Select all

php_value session.save_path "/full/path/to/tmp/directory"
thetallguy

Re: "unable to write session data" during install and admin switches to IP addre

Post by thetallguy »

Hmm...  Now I've got an Error 500.  My server logs seem to also be hidden, but I'm guessing based on a quick google search that my ISP has also locked down the PHP config.  When I talked to my ISP's tech support earlier, they told me that I need to insert it into the page itself.

Should I just insert "session_save_path('pathblahblahblah');" into the include.php somewhere?  (I'm still a PHP novice, so I'm guessing on this code fragment.  Google is my friend. :)

Michael
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: "unable to write session data" during install and admin switches to IP addre

Post by Ted »

Yeah, include.php is the perfect spot.  Right before

Code: Select all

@session_name("CMSSESSID");
Though, I must say that your ISP is being a little unreasonable...
thetallguy

Re: "unable to write session data" during install and admin switches to IP addre

Post by thetallguy »

Thanks, I'll give that a try.  As for the ISP being unreasonable, I must say that this particular one has brought forth more swear words from me than any other I can remember.  To be fair to them, though, they explained that they lock down the server this way because the server is operating within a cluster. Incoming requests are routed to arbitrary servers within the cluster.  Therefore, the normal caching functions of PHP won't work right, since they're machine-specific. 

This is the first ISP I've dealt with to do things this way.  And they do a mighty poor job of documenting their special requirements.  At least their tech support people are pretty quick and helpful.

Michael
thetallguy

Re: "unable to write session data" during install and admin switches to IP addre

Post by thetallguy »

Score!  Thanks, Wishy!  Here's the full text of the change to the include.php file, starting at line 34. (I've included the lines before and the line after to give you the context.)

Code: Select all

set_magic_quotes_runtime(false);

/* ---------------------------
Edits to fix problem where PHP fails on a locked-down cluster server 
*/

#Load the config file (or defaults if it doesn't exist)
require_once(dirname(__FILE__)."/version.php");
require_once(dirname(__FILE__)."/lib/config.functions.php");

#make a local reference
#if (cms_config_check_old_config()) {
#	cms_config_upgrade();
#}
$config = cms_config_load(true);

#Override the session save path if necessary
if (isset($config['php_session_path']) && $config['php_session_path'] != '')
{
	@session_save_path($config['php_session_path']);
}
/* end change 
 ---------------------------*/

#Setup session with different id and start it
@session_name("CMSSESSID");
As you can see, I moved the loading of the config file up so that I could use a config parameter as an override string.  That doesn't appear to have broken anything... yet. :)  I have not changed cms_config_load to provide a default value, though I probably should.

Thanks so much for the assistance!  You don't know what a relief it is to be past this issue!

Michael

PS: I am supplying the code in case others have need of it.
Locked

Return to “[locked] Installation, Setup and Upgrade”