Re: Strange Problem: session_set_save_handler

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

 



Ok,

i try to describe what i´ve 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

(i´ve 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 i´ve 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. i´ve 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 i´ve
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 hasn´t 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 i´m a little bit confused because i´ve neither edited the config-file nor
changed something in my session-functions.



again the problem i HAD :)

when i´ve 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 doesn´t 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 i´ve 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@xxxxxxxxx> schrieb im Newsbeitrag
news:47.51.05285.0BE0DC24@xxxxxxxxxxxxxxx
> Hi, i´ve a strange Problem with the session_set_save_handler-Function.
>
> Firt of all my config:
>
> in my intranet i´m 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
>
> i´ve written some function to store session-data in a table on the
>
> mysql-server.
>
> because of the fact that i´ll never see if the write-session-function is
>
> called i´ve 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 i´ve 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.

-- 
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