A website accessed by an IP address cannot store SESSION variables. this is the first time you have encountered such a strange problem.

Source: Internet
Author: User
A website accessed by an IP address cannot store SESSION variables. this is the first strange problem. Check the code first. the PHP page code for testing is as follows: PHPcode & lt ;? Phpsession_start (); if (isset ($ _ SESSION [& quot; Count & quot;]) {$ count =$ _ SESSION [& quot; A website accessed by an IP address cannot store SESSION variables. this is the first strange problem.
Check the code first. the PHP page code for testing is as follows:
PHP code
  
  ';echo 'ID:'.session_id();$_SESSION["Count"]=$count;?>

----------------------------------
Undoubtedly, this code is absolutely correct. test results on the local PHP5.2 + APACHE host:
------------------
= Page refreshed for the first time =
Count: 1
ID: 60499dfb22e443a89f5f8ef161570fb0
= Second page refresh =
Count: 2
ID: 60499dfb22e443a89f5f8ef161570fb0
= Page refreshed for the third time =
Count: 3
ID: 60499dfb22e443a89f5f8ef161570fb0
------------------
However, when I save this code as a webpage and upload it to a PHP5.2 + APACHE space I bought in the United States, the problem arises !!

Test results of accessing this page over my local network:
------------------
= Page refreshed for the first time =
Count: 1
ID: b8611df96a9371f930d8838c0cbc5d77
= Second page refresh =
Count: 1
ID: 3ae67bfa8cdf1dda-e1c763fb8f7e2d8
= Page refreshed for the third time =
Count: 1
ID: e2fc2942aeb87f63ce2253b0e6cc3a4d
------------------

When I see the above results, my first response is that the SESSION settings in PHP. INI are incorrect. The results are verified over and over again, and the local PHP. INI file is uploaded and overwritten. The results are the same.

Then, the FF \ IE cache and COOKIE are cleared. And access from another computer on this website, but the results still do not work.

No way, I can only think that there is a problem with the server, and then ask the service provider to solve the problem. The service provider asked me for a day and told me that the server was correct.

At this time, I was very angry. I clearly showed that the test results were incorrect. how can I help you? Can it still be my network problems? I immediately hung up the proxy IP to access my website and got the correct running result !!! Then I used an online proxy IP address to access the website. The result is correct !!

Now I am depressed !! What is the situation? It is reasonable to say that the IP address of a foreign server is easily blocked by the domestic ISP service provider, resulting in access failure in China. But what's the situation with Nima? Clearly accessible, that is, a new session id will be generated for each access. check the SESSION_SAVE_PATH cache folder and the special cache file. what is the situation.

Please help me with Daxie and Daxia Xiaoxiao. it is really a crash !!! Thank you!


------ Solution --------------------
I accessed the website slowly. Where is your server? Let you output phpinfo information. In addition, it is difficult for you to operate sessions so frequently. sessions are server-side.
------ Solution --------------------
I tested that the session on your server is normal. The problem is not that the server is on your own network or computer.

------ Solution --------------------
No problem.
------ Solution --------------------
It is impossible to relate to the network. can you still remove cookies from your package?

Obviously, your browser does not save the COOKIE. you can capture the packet to see if your request does not contain the COOKIE every time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.