Menu

PHP 5 session problems

Help
2007-03-29
2013-03-22
  • Mark McBride

    Mark McBride - 2007-03-29

    Sessions in PHP 5 seem to be broken. I was getting the message "Call to a member function getTextValue() on a non-object in /usr/local/psa/include/sessions.php on line 104".

    I was able to get past the error with a change to include/config.php.

    if(!defined('PSA_INSTALLING') && !defined('PSA_RESTRICT_INC')) {
        session_start();
        session_write_close();
    }

    but the screens keep going back to the login screen.

    What seems to be my problem?

     
    • Justin Koivisto

      Justin Koivisto - 2007-03-29

      getTextValue is a function of PEAR::MDB, so my guess is either that is not installed or misconfigured. I have been running this piece of code successfully on PHP5 since before the 4.0 release.

       
    • Mark McBride

      Mark McBride - 2007-03-30

      I do have the Pear::MDB module installed. Are there other things I can test for?

       
      • Justin Koivisto

        Justin Koivisto - 2007-03-30

        If the function is undefined, it would seem that one of the MDB (or MDB itself) isn't being included during execution. Check for file not found errors in the error log and be sure you have the correct RDMS type in the config file.

         
    • Mark McBride

      Mark McBride - 2007-03-30

      In the session.debug.txt, it looks like it is working, but it asks for a loging every time I ask for a new page or refresh the current.

      *****************************
        Read Session: 623c6adb91e5ac0f0d64a50b2fb26323
          SELECT psa_sessions.value FROM psa_sessions WHERE psa_sessions.sesskey='623c6adb91e5ac0f0d64a50b2fb26323' AND psa_sessions.expiry > 1175256842
          Session Exists: 623c6adb91e5ac0f0d64a50b2fb26323
          Session Data:
        Garbage Collection
          DELETE FROM psa_sessions WHERE psa_sessions.expiry < 1175256842
        Write Session: 623c6adb91e5ac0f0d64a50b2fb26323
          Check Session: 623c6adb91e5ac0f0d64a50b2fb26323
          Session Data:
            SELECT psa_sessions.sesskey FROM psa_sessions WHERE psa_sessions.sesskey='623c6adb91e5ac0f0d64a50b2fb26323'
          Key Exists: 623c6adb91e5ac0f0d64a50b2fb26323
            UPDATE psa_sessions SET psa_sessions.expiry=1175258282, psa_sessions.value='' WHERE psa_sessions.sesskey='623c6adb91e5ac0f0d64a50b2fb26323' AND psa_sessions.expiry > 1175256842
          Session Data:
          Session Expire: 1175258282
      Close Session
      ***********************************

       
    • Mark McBride

      Mark McBride - 2007-04-03

      ****************************
      pear install MDB
      Skipping package "pear/MDB", already installed as version 1.3.0
      No valid packages found
      install failed
      ****************************

      How do I check for session.use_trans_sid and PHP's gettext extension?

       
      • Justin Koivisto

        Justin Koivisto - 2007-04-06

        checking the phpinfo() output is the quickest way

         
    • lycaste

      lycaste - 2007-04-06

      Here I have the same problem, in the same configuration. All Pear installations are ok. I have made some trace, and just look into the error message:

      "Call to a member function getTextValue() on a non-object in /usr/local/psa/include/sessions.php on line 104"

      it means the object pointer used (ie $PSA_SESS_SQL in the source) is no longer valid (it's value is set to TRUE).

       
      • Justin Koivisto

        Justin Koivisto - 2007-04-06

        I went through the code, and do not see anywhere in sessions.php where $PSA_SESS_SQL is actually set to true. What version of MDB do you have installed? I assume it is the 1.3.0 version since that was the last release and it has been quite a while now.

         
        • lycaste

          lycaste - 2007-04-07

          Yes, I use the last version 1.3.0 here. I don't understand why it is set to true, but the error is the same.

           
    • Mark Lawther

      Mark Lawther - 2008-05-03

      I'm having the same problem, only in version 4.0.3 the error occurs on line 105.  When logging in I receive a "Login Successful" message but when I click on any of the menu options (Users, Profiles, Pages, Settings) I am kicked back to the login page.  And it logs a "PHP Fatal error:  Call to a member function getTextValue() on a non-object in C:\Program Files\eclipse\workspace\psa\include\sessions.php on line 105" with every login attempt or page view.

      I have installed and verified all that has been mentioned previously.
      1. MDB version 1.3.0 is installed correctly. 
      2. phpinfo reports gettext installed and enabled.
      3. phpinfo reports session.use_trans_sid is set to 1.

      Query statements other than line 105 execute properly and appear in my sql log so I know MDB and gettext are functioning properly.  I have arrived at the same conclusion as lycaste above in that the object $PSA_SESS_SQL is no longer valid but I can't figure out why.

      Any help or additional things to look at/try would be greatly appreciated. 

      PSA Version: 4.0.3
      Server OS: Win XP SP2
      Web Server Software: Apache 2.0.48
      Database System: mysql 5.0.51
      PHP Version: 5.2.5
      PEAR::MDB Version: 1.3.0

       
      • Mark Lawther

        Mark Lawther - 2008-05-07

        I put together a test machine with Ubuntu 7.10, Apache 2.2.4, PHP 5.2.3 and MySql 5.0.45 and it has the same problem.  So either I am consistent in what I am doing wrong or PSA doesn't get along with the newer version of one of its dependencies.  I'm betting on a PHP issue. 

         
      • Mark Lawther

        Mark Lawther - 2008-05-20

        Put this line in the top part of sessions.php

        register_shutdown_function("session_write_close");

        I found this solution here:
        http://www.php.net/manual/en/function.session-set-save-handler.php#75336

         
    • dacia

      dacia - 2008-07-11

      I am using PHP 5.2.6, PEAR 1.7.1.

      I have installed PEAR MDB and MDB2 because of this message I get from the webserver.

      [abe]$ pear install -o pear/MDB
      WARNING: "pear/MDB" is deprecated in favor of "pear/MDB2"
      downloading MDB-1.3.0.tgz ...
      Starting to download MDB-1.3.0.tgz (218,957 bytes)
      .............done: 218,957 bytes
      downloading XML_Parser-1.2.8.tgz ...
      Starting to download XML_Parser-1.2.8.tgz (13,476 bytes)
      ...done: 13,476 bytes
      install ok: channel://pear.php.net/XML_Parser-1.2.8
      install ok: channel://pear.php.net/MDB-1.3.0

      --end--

      QUESTION: How do I know which driver i am using as I am supposed to input this in the config file.

      Currently, I have:

      'phptype'       =>  'MDB-1.3.0',        // which PEAR::MDB database driver are you using?

      QUESTION: How do I know if this is the correct driver for PEAR::MDB?

       
      • Justin Koivisto

        Justin Koivisto - 2008-07-11

        the phptype is expecting an entry like 'mysql' or 'pgsql'

         
    • dacia

      dacia - 2008-07-14

      Thanks for your response. 

      I am now getting a session issue and am unable to open the index.php file.

      Fatal error: session_start() [<a href='function.session-start'>function.session-start</a>]: Failed to initialize storage module: user (path: /tmp) in /home/.garages/missdacia/website/include/config.php on line 74

      I am using PHP 4.4.8 with gettext enabled and session.use_trans_sid turned On.

      Doesnt seem to like the session_start() call in config.php.

       
    • dacia

      dacia - 2008-07-14

      I found in lots of forums that session.save_handler set to 'files' for local and master value fixes this issue, but mine is already set to 'files' and still the same error.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.