2012-08-28 79 views
0

我有一个PHP的形式,其中一个用户给我看,他们收到一个致命的错误:不一致的致命错误:最长30秒的执行时间超过

Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache2.2\htdocs\eeallparts\registration.php on line 282. 

奇怪的是,他们又重新提交表单和表单工作,因为它应该将数据插入到数据库中,所以这不是一致的错误。我在表单上收到了很多意见(这些表单相当程度上是垃圾邮件),所以我知道表单通常可以工作,但这种随机错误显然困扰着我。

我去了线282,我唯一看到的是这样的:

if(!$insertContact_query = mssql_query($sql)) {  

我看过一些与此相关的其他线程建议看set time limit的。如果查询花费太长时间,查询几乎总是超时而不是周期性地超时?我让用户在表单中重新提交了相同的信息,并且第二次运行?

+0

你的网页做了多少工作?它是添加数百行数据,还是仅仅是一对? – andrewsi

+0

可能存在底层SQL服务器本身存在的问题(性能问题,碎片等),或者您拥有任何PHP缓存(dis/en)能力。 – Breakthrough

+0

“如果查询花费的时间太长,查询几乎不会”不,这可能是一个锁定问题,这取决于冲突。它可能需要更长的时间在流量高峰期,... – Tchoupi

回答

1

时间限制不包括花费在查询数据库所花费的时间等任何外部数据源上的时间。

The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running. This is not true on Windows where the measured time is real.

如果查询返回大数据集,它可能仅在处理集合时超时。如果可能,请使用php配置文件指出瓶颈。

+2

“在测量时间是真实的Windows上,这不是真的。”,如果仔细观察问题,您会看到海报正在运行Windows。 SQL查询/引擎肯定会导致这种情况。 –

+0

你说得对。我一直在我的PHP开发中使用Linux,并没有注意到这一点。 – NathanD

相关问题