Home  >  Article  >  Backend Development  >  会是什么原因招致session_start启动慢

会是什么原因招致session_start启动慢

WBOY
WBOYOriginal
2016-06-13 11:10:08896browse

会是什么原因导致session_start启动慢。
PHP首次启动session_start非常慢。(等好几分钟)


客户端有生成PHPSESSID COOKIE后访问速度就恢复正常。
把PHPSESSID COOKIE删除后打开又很慢了,当首次打开完成生成PHPSESSID后又恢复正常。

就这么两行代码:

session_start();
phpinfo();

?>

会是什么原因导致session_start首次启动这么慢? 
排查了很多的地方没找到原因……


------解决方案--------------------
首次 ???
再次吧?
------解决方案--------------------
没遇到过,多用几个浏览器测试看看。
------解决方案--------------------
4.6 min?...内牛满面....
------解决方案--------------------
不知道这文章能解决你问题否:
http://www.daimami.com/operating-system/501202.html
------解决方案--------------------
引用手册上的,不知道对不对题目
引用
There are some posts around about session_start() beeing terribly slow on ntfs. for me the problem occured from one day to another, system was already running fine for 2 years.
to get around it implementing a custom session_set_save_handler could be an option, although for me it worked just to put a session_write_close() somewhere near the end of my script. (maybe IIS didn't kill the php-threads fast enough?!) 

------解决方案--------------------
继续手册上与“slow”相关的:

A note on Windows installations with an NTFS file structure:

Make sure you give your Internet user account (usually IUSR_MACHINENAME) "Modify" access to the session.save_path directory.  Otherwise session_start() will silently - and oh, so slowly - fail.

("Modify" is a Win2k term, but the concept translates to older IIS installs). 
------解决方案--------------------
引用:
PHP首次启动session_start非常慢。(等好几分钟)


客户端有生成PHPSESSID COOKIE后访问速度就恢复正常。
把PHPSESSID COOKIE删除后打开又很慢了,当首次打开完成生成PHPSESSID后又恢复正常。

就这么两行代码:

session_start();
phpinfo();

?>

会是……

同样的代码我在linux下测试没有这个状况.
所以你该考虑得问题应该是windows的问题,而不是php的问题.
------解决方案--------------------
如果你用linux出现这个问题的话,那么比较简单了,安装一个mrtg检测一下CPU,IO,磁盘,内存等等的使用状况就好了,这样你就能通过这个值了解到究竟是哪里导致此问题的发生.
------解决方案--------------------
重编译下或者换个版本?
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn