• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

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

php 搞代码 3年前 (2022-01-24) 21次浏览 已收录 0个评论

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

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

就这么两行代码:
<?php

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).
——解决方案—————-来@源gao*daima.com搞@代#码网搞gaodaima代码—-

引用:

PHP首次启动session_start非常慢。(等好几分钟)

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

就这么两行代码:
<?php

session_start();
phpinfo();

?>

会是……

同样的代码我在linux下测试没有这个状况.
所以你该考虑得问题应该是windows的问题,而不是php的问题.
——解决方案——————–
如果你用linux出现这个问题的话,那么比较简单了,安装一个mrtg检测一下CPU,IO,磁盘,内存等等的使用状况就好了,这样你就能通过这个值了解到究竟是哪里导致此问题的发生.
——解决方案——————–
重编译下或者换个版本?


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:会是什么原因招致session_start启动慢

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址