thanks guys...i'm starting to feel like my questions are legit...hope you can deal with all the questions here:
thorpe wrote:Q1: What this means is that php4 has the ability to automatically add a users session ID to the end of a URL. Saves you having to track it yourself.
What, exactly, does that mean that is 'has the ability' to automatically add the sid to the url? Does that mean that the session id will ALWAYS be created and defined with php 4? What happens when cookies are turned off? does PHP automatically add a session id to each and every relative URL? Are these session IDs visible to users? The concept of 'url rewriting' is kind of puzzling to me.
phpBB's source code takes great pains to ensure that the session id gets propagated thru URLs if necessary. They demand that ALL urls have to be wrapped in a function call append_sid(). the source:
//
// Append $SID to a url. Borrowed from phplib and modified. This is an
// extra routine utilised by the session code above and acts as a wrapper
// around every single URL and form action. If you replace the session
// code you must include this routine, even if it's empty.
//
function append_sid($url, $non_html_amp = false)
{
global $SID;
if ( !empty($SID) && !preg_match('#sid=#', $url) )
{
$url .= ( ( strpos($url, '?') != false ) ? ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
}
return $url;
}
Is that function in phpBB's source code overkill, unnecessary, or best practice? It seems like a total pain in the ass to me.
Execute had a really good point about search engine issues. I think the googlebot is smart enough to deal with the session ids--i haven't had any problems with my other sites. My concern is mostly about PHP4's 'ability to add a session id to the URL'. Does the PHP url rewriting functionality sniff out the browser agent and skip adding the URL for bots? Surely bots aren't smart enough to drop session IDs? At any rate, if I use the phpBB approach I could put in my own user agent sniffer to drop session IDs for web crawlers.
I had already read the man pages on session_set_save_handler() and it seems to make sense, but i was wondering why the function for session_open requires a file path?? If my plan is create custom session handling functions that use mySQL, what is the significance of the save path? The php man pages don't offer much help in understanding what goes on with the save path (nor do the zend pages).
As for performance of a database vs. file-based session storage, I'm not sure where the performance issue might lie, but I seem to recall it had something to do with disk fragmentation and garbage collection on busy web servers. Many sessions would mean countless little files on the hard drive. The PHP man pages warn "Note: On some operating systems, you may want to specify a path on a filesystem that handles lots of small files efficiently. For example, on Linux, reiserfs may provide better performance than ext2fs. "
execute: thanks for the info.