Apache的相同渊源考请求阻塞 [英] Apache same orgin request blocking

查看:274
本文介绍了Apache的相同渊源考请求阻塞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试加载两个相同的页面,从我在同一浏览器的不同选项卡的服务器,它会等待一个启动其他前完成。这是不错,但我有一个cron的过程,需要调用几个电话给同一个脚本,我不能有这种类型的拦截行为。我想这是因为过程中有与服务器相同的会话/连接,默认行为是只允许从同一来源一个请求...我怎么能解决这个得到什么?我希望能够做的是有一个cron进程能够将呼叫断火到我的脚本和Apache的一个旋转起来有针对性的脚本的新实例来处理每一个请求。这可能吗?

When I try to load two of the same page from my server in different tabs of the same browser, it waits for one to finish before starting the other. This is fine but I have a cron process which needs to call several calls to the same script and I can't have this type of blocking behavior. I think it is because the process has the same session/connection with the server and the default behavior is to only allow one request at a time from the same source... how can I get around this? What I want to be able to do is have a cron process be able to fire off calls to one of my scripts and apache spin up a new instance of the targeted script to handle the request for each one. Is this possible?

推荐答案

您使用PHP的标准基于文件的会议? PHP锁定会话时,你做了在session_start(),并保持锁定文件,直到脚本退出,或者你做了 session_write_close()

Are you using PHP's standard file-based sessions? PHP locks the session when you do a session_start() and keeps the file locked until the script exits, or you do a session_write_close().

这有$ P $的被担任了,因为直到锁被删除,他们不能在会议文件中获取pventing任何其他支持的会话页面的效果。

This has the effect of preventing any OTHER session-enabled pages from being served up, as they can't get at the session file until the lock is removed.

session_write_close()可以在脚本中的任何一点调用。它所做的就是写出来的_SESSION数组,因为它是在那一刻,但留下可供阅读的数组。您可以在以后重新打开该会议上的脚本,如果您需要进行任何修改。

session_write_close() can be called at any point in the script. All it does is write out the _SESSION array as it is at that moment, but leaves the array available for reading. You can always re-open the session later on the script if you need to make any modifications.

基本上,你不得不

<?php

session_start(); // populate $_SESSION;
session_write_close(); // relinquish session lock

.... dome some really heavy duty long computations

session_start();
$_SESSION['somekey'] = $new_val;

这篇关于Apache的相同渊源考请求阻塞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆