Announcement

Collapse
No announcement yet.

session_set_save_handler() function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • session_set_save_handler() function

    i have this php file that have this function session_set_save_handler() that save the session files into mysql database...

    as everyone knows, this function will change the setting of session.save_handler from files to user in the local value while in the master value, it remains as files... on the php.ini file

    my question is will my php file affect other php files that deals with sessions, they might be using the default value (files) for handling sessions... these php files are on the same server as i am.....

    it is an apache server running linux with php 4.1.2 installed...

    thanks...

  • #2
    I would say only if it is the same domain. like you site. if that script changes it and tehn you run another script it might have an effect.

    Comment


    • #3
      session_set_save_handler() only effects the current file.
      Chen Avinadav
      Better to remain silent and be thought a fool than to speak out and remove all doubt.

      גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

      Comment


      • #4
        so changing session.save_handler from files to user doesn't ahve an effect on other files? I thought it would since you are changing a environment variable.

        Comment


        • #5
          Originally posted by scoutt
          so changing session.save_handler from files to user doesn't ahve an effect on other files? I thought it would since you are changing a environment variable.
          Not if you're using ini_set() to do it.
          Chen Avinadav
          Better to remain silent and be thought a fool than to speak out and remove all doubt.

          גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

          Comment


          • #6
            correct me if i'm wrong....

            the function session_set_save_handler only affect the php file that call it, which is mine.... while the other php file that deals with session will still be using the default value (files) to handle their session...

            if i use ini_set()... it will permanently set the value in the php.ini to the value i want...

            thanks for the replies....

            Comment


            • #7
              Originally posted by etron_neo
              if i use ini_set()... it will permanently set the value in the php.ini to the value i want...
              No, ini_set() only effects the current file as well. You can't directly modify php.ini from within a PHP script, you can only change values in it locally.
              Chen Avinadav
              Better to remain silent and be thought a fool than to speak out and remove all doubt.

              גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

              Comment


              • #8
                ok.... the way i understand it is something like this....

                the php file will get an instance of the php.ini and change the appropriate field eg. the session.save_handler to user and this setting will only affect my php file....

                while other php files, which is not mine, will get another instance of php.ini, which has the default / original value for all the fields... and these php file will modify the value inside their own local php.ini to suit their needs....

                therefore, the master copy of php.ini will have all the default values for its fields....

                sorry for any inconvience that has occur..... i'm new to php and i do not want to create a mess with other php files when i upload all my php files into the server.....

                thanks FireFly for helping me....

                Comment


                • #9
                  this might sounds better: etron_neo,

                  Sets the value of the given configuration option. Returns the old value on success, FALSE on failure. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending.

                  Comment


                  • #10
                    Sets the value of the given configuration option. Returns the old value on success, FALSE on failure. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending.
                    how about when my php script (eg my.php) and other php script (eg other.php) running on the same time....

                    my.php will change the value to user while other.php will be using the default value (files)...

                    so, what will happen then... will the php.ini holds value "user" or "files" now...

                    or... on the local value... my.php will set the value to "user" and other.php will get the default value (files)...

                    i can't seem to understand the concept correctly... sorry for that.... and thanks for the help....

                    Comment


                    • #11
                      Ok, let's try this again.

                      When a PHP script is called (loaded), it "reads" php.ini and holds all the configuration variables from it. When you use ini_set(), it changes the config option internally, without even touching php.ini.

                      So even if 100 scripts are running on the exact same time, ini_set() will only effect the file it was used in.
                      Chen Avinadav
                      Better to remain silent and be thought a fool than to speak out and remove all doubt.

                      גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                      Comment


                      • #12
                        i think i understand now....

                        When a PHP script is called (loaded), it "reads" php.ini and holds all the configuration variables from it. When you use ini_set(), it changes the config option internally, without even touching php.ini.
                        so... no matter what i do to the configuration values... it will change it locally in the loaded.php... while the other php scripts remain untouched...

                        now, i know what that local value mean...

                        all of the sudden.... the sky seem very clear now..... thanks for clearing it up for me.....

                        Comment

                        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                        Working...
                        X