简体   繁体   English

在Apache上同时连接

[英]Simultaneous connections on Apache

So, it seems that when a client makes more than 1 connection to the web server ( Windows + Apache 2.0.x + PHP 5.1.6 ) it dies. 因此,似乎当客户端与Web服务器(Windows + Apache 2.0.x + PHP 5.1.6)建立多个连接时,它就死了。 eg 例如

I put 1 phpthumb call - eg 我把1 phpthumb电话-例如

<img src="/library/classes/3rdparty/phpthumb/phpThumb.php?src=/media/images/gallery/cart1.jpg&w=100&h=100" />

That works. 这样可行。 But if I put like 3 on the page, it just loads forever ( according to firebug ) .. and it never shows! 但是,如果我在页面上放置3,它只会永久加载(根据firebug)..并且永远不会显示!

Browsers do limit the number of concurrent connections to a web server, simply queueing them up ready to be requested once a "slot" becomes free. 浏览器确实限制了与Web服务器的并发连接的数量,只需在“插槽”空闲时将它们排队即可请求。 The actual number of concurrent connections varies from browser to browser and even version to version, and can sometimes be changed by the browser's user. 并发连接的实际数量因浏览器而异,甚至因版本而异,有时浏览器用户可以更改。 Web servers may also limit the number of concurrent connections. Web服务器还可能限制并发连接的数量。

If each queued request takes a long time to run, then you could run into difficulties with this, making the whole thing seem very slow. 如果每个排队的请求都需要很长时间才能运行,那么您可能会遇到麻烦,使整个过程看起来非常缓慢。

If you're using sessions in your PHP script, then it can be even slower, because only one instance of a script can acces sthe session file at a time... and if it doesn't release it's lock until it's finished running, then effectively your connection limit is being restricted to 1 at a time. 如果您在PHP脚本中使用会话,那么它可能会变得更慢,因为一次只能有一个脚本实例访问该会话文件...如果不释放它,直到它运行完毕,它才会被锁定,那么有效地将您的连接限制一次限制为1。 One potential solution to this is not to use session_start() unless you need to; 一种可能的解决方案是除非需要,否则不要使用session_start()。 another is to release the session lock as soon as you've finished accessing the session file using session_write_close() 另一种方法是在使用session_write_close()完成访问会话文件后立即释放会话锁。

尝试在/library/classes/3rdparty/phpthumb/phpThumb.php中使用session_destroy()

What version of PHP did you install, VC6 and thread-safe or not? 您安装了哪个版本的PHP(VC6和线程安全的)? I would look into that and switch to the correct one depending on how you use it (check http://windows.php.net/download/ - Which version do I choose?)... 我会调查一下,然后根据您的使用方式切换到正确的版本(检查http://windows.php.net/download/-我选择哪个版本?)...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM