|
Posted by "Thorsten Friedrich" on 07/08/05 10:59
Ok,
i try to describe what ive done.
i have written a sql-wrapper-class wich is used to insert and update the
entries in the mysql-table.
the mysql-table has the following columns (types)
id varchar(255) - holds the session-id
data blob - holds the session-data
created timestamp - used to identifiy the creation-date
lastmodify timestamp - used to identifiy the last-change on this row
the wrapper-class is created in the read / write / destroy and
timeout -callbackfunction
in the read-function only the row by the session-id is selected
in the write-function first i check if a row by this session-id exists
if not -> insert a new row with the give session-id and session-data
if exists -> update the row identified by the given session-id
in the destroy-function i drop the row identified by the session-id and
reset the session_set_save_handler
(ive read that this function also destroy the handler-settings)
in the timeout-function which is called in the open-function i check if
there are rows older than the given session-timeout (by default set to 1440
seconds)
now the logging:
in the wrapper-class ive implemented a function that is able to log every
query made to any table of the database to a file on the server. i think
this should write ALL queries to the log-file even these one made by the
session-handlers.
(perhaps it should be said that i see the DELETE QUERY made by the
timout-function and also the SELECT Query made by the read-function)
ok. at least i again will describe what happens yesterday.
i got this problem and searched the internet for the solution. ive found
some articles in different forums but mostly not the answer i needed to
solve the problem.
to see what realy happens i enabled the error_reporting to log really all
what happens (error_reporting=E_ALL).. restarted the webserver (which ive
restart several times during this problem) and then it works again. after
disabling the error_reporting (set to E_ALL & ~E_NOTICE) nothing has
changed. it works like the problem hasnt been.
i know that this step has nothing to do with it... but i want to see if php
returns an error to identify.
so im a little bit confused because ive neither edited the config-file nor
changed something in my session-functions.
again the problem i HAD :)
when ive started the web-application and turned on (i do this by a flag) my
db-based-session-handling the write-function does nothing (no session-data
is added or removed from session-data in the mysql-table). if i turned on
the logging in the sql-wrapper-class (to write the queries made by the
application and wich is also used and called in the handling functions) php
crashes with no error and no output to the browser. so it is a must that php
crashed before the stream to the client is made.
to check if php gives an error if done the following (this is no joke).
i want to produce an error in the write-function by adding a line like this:
adasdfasdf
without the ; in the end it works (sure the write-function doesnt update
the db-entry)
adding the ; at the and php crashes
to see if post-streaming a error is displayed i logged in via ssh and call a
script by using the following command:
php -q ./<script.php> same result.
and again: after ive changed the loggin in the php.ini from E_ALL &
~E_NOTICE to E_ALL and than again back to E_ALL & ~E_NOTICE the problem has
gone. it now works like the 2 weeks before i restarted the server.
so i hope the problem (i had *G) is better described as in the news-letter.
i you know what the problem is it would be nice to answer because i want to
know how to fix the problem if it occours the next time.
Thx 4 Help and best greetz
Thorsten Friedrich
""Thorsten Friedrich"" <t.friedrich@tebra.net> schrieb im Newsbeitrag
news:47.51.05285.0BE0DC24@pb1.pair.com...
> Hi, ive a strange Problem with the session_set_save_handler-Function.
>
> Firt of all my config:
>
> in my intranet im using 2 servers
>
> the first server is the db-server running mysql v. 12.22 dist 4.0.24
>
> the second server is the webserver
>
> running apache2 Linux apache 2.6.5-7.147-smp running
>
> and is using php v. 4.3.4
>
> ive written some function to store session-data in a table on the
>
> mysql-server.
>
> because of the fact that ill never see if the write-session-function is
>
> called ive placed a write-a-log-to-disk function in all session-function
to
>
> see if they are called.
>
> when i use "files" in the /tmp-directory to store the session-data
>
> everything works fine, but if i switch to the db-based-system php crashes
>
> with no error message (crash in this case means that a empty page is
>
> transfered to the client).
>
> a sideeffect of this problem is the following:
>
> i use some wrapper-classes to handle database-insert/select and updates.
if
>
> i use the file-based-session-handling i can select the content of the
>
> session-table, but when i use the db-based my wrapper class get a empty
>
> record-set when i try to select the table where the session-data is
stored.
>
> using a programm like sqlyog i can see the entries written by my
>
> handler-functions.
>
>
>
> the realy strange thing is the following:
>
> till yesterday everything works fine (yes, also the db-based-handling).
>
> today ive rebootet the webserver. no config-files has been changed. after
>
> the computer has been booted the described problem occured.
>
>
>
> can anybody help me to fix this problem or give some hints where to find
the
>
> error?
>
> thx for help.
Navigation:
[Reply to this message]
|