Error after Install

Help
JarreFan
2005-04-10
2013-04-24
  • JarreFan
    JarreFan
    2005-04-10

    HEllo, my hosting just upgraded PHP at version 4.3.11, and now when I try to connect to my website, I get this error

    "
    Warning: session_set_save_handler(): Argument 2 is not a valid callback in /home/mediatec/public_html/biblio/polerio/lib/Session.php on line 127

    Fatal error: session_start(): Failed to initialize storage module: user (path: /tmp) in /home/mediatec/public_html/biblio/polerio/lib/Session.php on line 211
    "

    What could I do?

     
    • Stefan Elsner
      Stefan Elsner
      2005-04-13

      I searched the web and found the following information:

      - it's a known bug in php (haven't heard about it before)
      - they recommend two things:

      a) try changing your current php settings for session.save_handler user files
      to session.save_handler files

      or if you don't have accessrights to the php.ini file:

      b) add the follwoing line before the session_start() call
      ini_set('session.save_handler', 'files');

      I also found a third option using a .htaccess file....

      they end up doing all the same- hopefully one works for you

       
    • JarreFan
      JarreFan
      2005-04-13

      Uhm!
      Tnx for replying! I made what u suggested in the file "Sessions.php", but I still had some errors:

      Warning: session_set_save_handler(): Argument 2 is not a valid callback in /home/mediatec/public_html/biblioteca/polerio/lib/Session.php on line 127

      Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/mediatec/public_html/biblioteca/polerio/lib/Session.php:127) in /home/mediatec/public_html/biblioteca/polerio/lib/Session.php on line 211

      Then I tried to delete the rows
      "// Session handlers
          session_set_save_handler("SessionOpen",
                                   "SessionClose",
                                   "SessionRead",
                                   "SessionWrite",
                                   "SessionDestroy",
                                   "SessionGC");
      "
      And it *seems* it's working!!!

      Do u know if there are other files where I have to change
      ini_set('session.save_handler', 'user');  in 'files'? Do u think that deleting the "session_set_save_handler" can take to other problems?

      Thanks, for now... u really made my day.

       
    • Stefan Elsner
      Stefan Elsner
      2005-04-13

      hi,

      it seems like the init_set solved your problem the message you got afterwards- is due to the warning:

      "Warning: session_set_save_handler(): Argument 2 is not a valid callback i"

      when a warning is displayed, the server can't send any more
      headers- whcih leads to the second Warning: "session_start(): Cannot send session cache limiter"

      the line you deleted might by important- what it does, it defines functions that get called when ever the session handling is required. the line 127 seems to cause that warning because- there is no function named "SessionClose" hence the warning. instead of deleting  the complete line, you could change it to:

      session_set_save_handler("SessionOpen",
      "pnSessionClose",
      "SessionRead",
      "SessionWrite",
      "SessionDestroy",
      "SessionGC");

      and give it a try.

      The problem is that the code is a tiny little bit buggy- this might help. Another option you have is to avoid that warnings etc. get displayed- you could try to avoid this by using
      error_reporting(0);

      which turns off all errors.

      sorry for the long reply- I'm hoping this gives you a little more insight of what could be done....

       
    • JarreFan
      JarreFan
      2005-04-13

      Why Sorry? U explained everything in a simple way, thank u again!
      I tried these tricks, but they don't work, for example when I make the login, I have another error page...similar to the first.

      I'll try it on my PC with EasyPHP on... I hope it'll work there too.

      Thanks again!

       
    • Stefan Elsner
      Stefan Elsner
      2005-04-13

      i checked- the problem seems to caused by php 4.3.11
      did you change the line 127 to

      session_set_save_handler("SessionOpen",
      "pnSessionClose",
      "SessionRead",
      "SessionWrite",
      "SessionDestroy",
      "SessionGC");

      ?

      I'll try to get the latest version of php in order to reproduce the error....

       
    • JarreFan
      JarreFan
      2005-04-15

      Sorry for my delay.

      Yes, i tried to appply the settings u suggested, but I had the same problems.

       
    • Dan Nelson
      Dan Nelson
      2005-08-16

      Having this problem as well. My php.ini file is already set to  session.save_handler = files, and I changed the Session.php file to use files instead of users.

      Found a bit of a lead on this in the php.ini file... session.save_path is commented out by default. Apparently Windows users (such as myself) have to set this explicitly in order to make use of sessions. I set mine to:
      session.save_path = "C:\Program Files\Apache Group\Apache2\tmp"

      It created a session file, and I'm down to two errors:
      [16-Aug-2005 10:12:00] PHP Warning:  session_set_save_handler() [<a href='function.session-set-save-handler'>function.session-set-save-handler</a>]: Argument 2 is not a valid callback in C:\Program Files\Apache Group\Apache2\htdocs\PhpMyLibrary\polerio\lib\Session.php on line 128

      [16-Aug-2005 10:12:00] PHP Notice:  Trying to get property of non-object in C:\Program Files\Apache Group\Apache2\htdocs\PhpMyLibrary\polerio\lib\Polerio.php on line 694

      Still plugging away...

       
    • Dan Nelson
      Dan Nelson
      2005-08-16

      Solved the "...Argument 2 is not a valid callback" error.
      Coding problem. On line 123-128 of Session.php, you'll find:
      session_set_save_handler("SessionOpen",
                                   "SessionClose",
                                   "SessionRead",
                                   "SessionWrite",
                                   "SessionDestroy",
                                   "SessionGC");

      Searching that file finds the function call for SessionClose is actually labeled "pnSessionClose". So, the function call on line 123 of Session.php should read:
      session_set_save_handler("SessionOpen",
                                   "pnSessionClose",
                                   "SessionRead",
                                   "SessionWrite",
                                   "SessionDestroy",
                                   "SessionGC");

      Still working on the last error...

       
    • Dan Nelson
      Dan Nelson
      2005-08-16

      Second error seems to be something related to doing searches while not logged in... looks like Polerio.php is querying fields on a recordset after selecting the user record based on a 'uid' field from session information. If you haven't logged in, or if your sessions aren't set up correctly, then my guess is this variable would be null, it wouldn't find the user object in the database, so the recordset object would also be null.