I copied an existing and successfully running site to a new development server.
The login on the new server is now broken, and I tracked it down to the fact that although the session cookie is renamed ...
ini_set('session.name', 'DOMAIN1');
... the browser keeps storing the sesssion cookie as PHPSESSID.
When I remove the above line from the application on the new server, the login works again. But this is not a good solution, because another application also uses PHPSESSID under this name.
And I would prefer to find the reason for the strange behaviour instead of using a workaround. If I don't fix it it could bite me somewhere else.
Maybe this is already enough information for someone to give me a hint. If not, what information would be useful?
This machine was a very naked and basic ubuntu 8.04 server, and I installed apache2, mysql and php5 with aptitude. I also updated lokales and the timezone.
Solution:
I replaced the line above with this code from from the accepted answer ...
if(ini_set('session.name', 'DOMAIN1') === false || !session_name('DOMAIN1'))
{
die('Unable to set sesssion scope');
}
... and the login now works on the new server.