ok so i am finding that when i set a session it is not retreivable from the next page. for example if i set a session using the following code on reload it stays "1".

<?php
session_start();  
if(isset($_SESSION['views'])) $_SESSION['views'] = $_SESSION['views']+ 1; else $_SESSION['views'] = 1; echo "views = ". $_SESSION['views']; ?>

here is the page i get for php info

Directive Local Value Master Value 
session.auto_start Off Off 
session.bug_compat_42 On On 
session.bug_compat_warn On On 
session.cache_expire 180 180 
session.cache_limiter nocache nocache 
session.cookie_domain no value no value 
session.cookie_httponly Off Off 
session.cookie_lifetime 0 0 
session.cookie_path / / 
session.cookie_secure Off Off 
session.entropy_file no value no value 
session.entropy_length 0 0 
session.gc_divisor 100 100 
session.gc_maxlifetime 1440 1440 
session.gc_probability 1 1 
session.hash_bits_per_character 4 4 
session.hash_function 0 0 
session.name PHPSESSID PHPSESSID 
session.referer_check no value no value 
session.save_handler files files 
session.save_path /tmp /tmp 
session.serialize_handler php php 
session.use_cookies On On 
session.use_only_cookies Off Off 
session.use_trans_sid 0 0 

from my ftp program there is no file called temp or tmp so i am lost.

any and all help is welcome

    the mysox1 wrote:

    from my ftp program there is no file called temp or tmp so i am lost.

    That's because most FTP servers are setup to restrict you to a specific "home" directory, which is of course almost never the root of the server's hard drive (where 'tmp' is located).

    Have you tried outputting the session ID (see: [man]session_id/man) on every page to see if it changes?

      is this local host\sharedhost\dedicated server?

        bradgrafelman;10972403 wrote:

        Have you tried outputting the session ID (see: [man]session_id/man) on every page to see if it changes?

        it does change every page load.

        i used this to check the session

        $a = session_id();
        if(empty($a)) session_start();
        die( "SID: ".SID."<br>session_id(): ".session_id()."<br>COOKIE: ".$_COOKIE["PHPSESSID"]);
        

        that gave me this:

        SID: PHPSESSID=7897c535f96ef229433a51c905f16e8a
        session_id(): 7897c535f96ef229433a51c905f16e8a
        COOKIE: 

        @
        I am using a free shared host.

          the mysox1 wrote:

          it does change every page load.

          Well then that's your problem. If the session ID is changing on every page load, that means your SID isn't getting propagated from one page to the next, thus every page load is causing a brand new session to be started.

          Check your browser's cookie settings to see if the cookie is being rejected.

            well how would i know if my cookies are being rejected? and is there a way arround this for users?

              the mysox1 wrote:

              well how would i know if my cookies are being rejected?

              Well that would highly depend on which browser you're using.

              the mysox1 wrote:

              and is there a way arround this for users?

              Sure - stop expecting web sites to function after you block parts of the HTTP protocol. :p

                I use IE 9. and yeah i guess that the problem is the browser not acccepting them since it works fine in ff.

                Sure - stop expecting web sites to function after you block parts of the HTTP protocol.

                what do you mean?

                  the mysox1 wrote:

                  what do you mean?

                  Some privacy setting in IE must be blocking the cookie.

                    how can i fix this and why would it come only after my page changed site url (with same hosting provider)?

                      the mysox1 wrote:

                      how can i fix this

                      No idea - I don't use Internet Explorer (nor could you even pay me to do so :p).

                      the mysox1 wrote:

                      why would it come only after my page changed site url (with same hosting provider)?

                      What do you mean?

                        may be worth a try, in IE: tools->internet settings->advanced->reset

                          that didn't work.

                          just a thjout would passing it in the url work?

                            at http://stackoverflow.com/questions/306132/php-session-problem-only-in-ie-really-strange-problem one answer was by Kieveli he said

                            Check the name of the server machine. IE has problems with machine names that contain '-' or '_' - they cannot maintain a session! I've had this problem twice in the past, and it always takes me weeks to figure out, and I'm shocked IE hasn't fixed it.

                            Just rename the machine to have no strange characters! You can get it working if you just use the IP address of the server in the url to test.

                            so i had to create a new domain. thx for all u guys help.

                              5 days later

                              now after reading ur post i realise i could've just used the ip address of their michine. bother but whatever i got it working.

                                Write a Reply...