致命错误:超出最大执行时间 400 秒
我有一个 PHP 脚本,在执行长 mysq_query 时失败。错误消息是:
Fatal error: Maximumexecutiontime of 400秒超过......
我使用XAMPP for windows并且我已经更改了php.ini文件(我的安装中只有一个),将max_execution_time设置为一个很大的值那不是400秒。尽管如此,我仍然收到上面的错误消息......
知道如何解决这个问题吗?
谢谢贝托
I have a PHP script that fails when executing a long mysq_query. The error message is:
Fatal error: Maximum execution time of 400 seconds exceeded in....
I use XAMPP for windows and I have changed the php.ini file (there is only one in my installation), setting max_execution_time to a large value that is not 400 seconds. Nevertheless I keep getting the error message above....
Any idea of how to solve this?
Thanks
Beto
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如 Ignacio 所说,某些内容可能会覆盖 php.ini 设置。您可以使用
set_time_limit
明确设置该脚本的超时。您也可以将其设置为 0,这会消除任何时间限制 - 尽管这不是最佳实践。
400 秒对于查询来说是一个巨大的时间 - 您是否考虑过在数据库中的常用列上添加索引?
As Ignacio says, something may be overriding the php.ini setting. You can definitively set the timeout for that script using
set_time_limit
You can also set it to 0, which removes any time restriction - although this is not best practice.
400 seconds is a huge amount of time for a query - have you looked into adding indexes on commonly used columns in your db?
您需要重新启动 PHP 的 Web 服务器来重新解析您的配置文件。
You need to restart your web server for PHP to re-parse your config file.
.htaccess
文件或 PHP 脚本中的某些内容可能会将其重置回 400 秒。话虽如此,400 秒对于查询来说仍然是过长的时间。如果确实需要那么长时间,您应该考虑将任务转移到另一个进程。
Something in either a
.htaccess
file or within a PHP script is probably resetting it back to 400 seconds.Having said that, 400 seconds is still an excessive amount of time for a query. You should consider farming the task off to another process if it really needs to take that long.