开发者

Why doesn't $_SESSION work after switching hosts?

Yesterday I switched ho开发者_开发知识库sts from 000webhost to ipage however when I went to login to my site the session wasn't being written. I have checked and the code is exactly the same on both hosts, why would this make a difference and how would i fix it?


Check in phpinfo() if PHP has session support and also check if session.auto_start is enabled.

You can also enable it in a .htaccess file with:

php_flag session.auto_start on


It is possible that your new provider doesn't automatically start sessions.

http://www.php.net/manual/en/session.configuration.php#ini.session.auto-start

Try calling session_start(); at the beginning of your script.

http://php.net/manual/en/function.session-start.php


You're probably missing a session_start() call on the new host which wasn't needed on the old one

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜