Re: apache sessions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, August 20, 2005 1:41 pm, Bawt T. Eggdrop wrote:
> im trying to change my session backend for apache from files to mysql.
> is there something php provides that allows a php script to execute
> before each page gets loaded in apache. if not i have to edit hundreds
> of php files...theres gotta be an easier way. thanks.

In an ideal world, the line of code did 'session_start();' would have
been designed in your code to be in ONE file that got included by
everything else.

In that case, you would only have one (1) file to edit, in which you
would do http://php.net/session_set_save_handler (or whatever it is)

Now, assuming you've got a zillion session_start() lines scattered
through your files, you should consider doing two things.

1. Fix it the "Right Way" (tm) and move all those into a 'globals.inc'
include file that all those files <?php include 'globals.inc';?>

2. Quick hack use php.ini auto_prepend feature to force a file to be
executed at the top of every file in your site.  This may be a
short-term way to keep working while #1 is the long-term project... 
OTOH, a good sed script, or even just a real long vi session with :%sg
:wn can fix the session_start() problem the right way, so it's not
gonna take THAT long to do it right.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux