|
Posted by "Richard Lynch" on 08/22/05 04:51
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
Navigation:
[Reply to this message]
|