php 超过 60 秒的最大执行时间错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1420249/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maximum execution time of 60 seconds exceeded error
提问by noob
I'm getting the following error message:
我收到以下错误消息:
Warning: file_get_contents(http://localhost/sample_pie.php) [function.file-get-contents]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xampp\htdocs\EXACT\report.php on line 206
Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\EXACT\report.php on line 206
警告:file_get_contents( http://localhost/sample_pie.php) [function.file-get-contents]:无法打开流:连接尝试失败,因为连接方在一段时间后没有正确响应,或建立连接失败,因为连接的主机未能响应。在 C:\xampp\htdocs\EXACT\report.php 第 206 行
致命错误:第 206 行的 C:\xampp\htdocs\EXACT\report.php 中超出了 60 秒的最大执行时间
Here is the line 206:
这是第 206 行:
$url = 'http://localhost/sample_pie.php';
$img = 'C:\xampp\htdocs\piechart.jpg';
file_put_contents($img, file_get_contents($url));
What do I have to do to fix this?
我该怎么做才能解决这个问题?
回答by RaYell
Your script executed for more then 60 seconds and was terminated. There is a value in php.ini defining maximum time PHP script can run. The purpose of this is to prevent scripts from hanging. You could try to optimize your script but if it's intended to run for so long you can just update the value (it's called max_execution_time).
您的脚本执行了超过 60 秒并被终止。php.ini 中有一个值定义了 PHP 脚本可以运行的最长时间。这样做的目的是防止脚本挂起。您可以尝试优化您的脚本,但如果它打算运行很长时间,您只需更新值(称为max_execution_time)。
You can also try changing this value for particular script by running set_time_limit() function, docs here
您还可以尝试通过运行 set_time_limit() 函数来更改特定脚本的此值,文档在这里
回答by user2129024
max_input_time can also cause the same error.
max_input_time 也会导致同样的错误。
回答by Sudar
The error means that PHP is not able to open http://localhost/sample_pie.phpto read the contents of the file. See if you are able to open the http://localhost/sample_pie.phpfile in browser.
该错误意味着 PHP 无法打开http://localhost/sample_pie.php来读取文件内容。看看你是否能够在浏览器中打开http://localhost/sample_pie.php文件。
Also is the page very large?
页面也很大吗?
回答by Ramesh Yadav
Just increase the max_execution_timein php.ini.Set it to 1800and restart your apache or any other server you are using.
只是增加了max_execution_time在php.ini.其设置为1800,并重新启动Apache或您使用的任何其他服务器。
回答by Jo?o Silva
It means PHP was unable to access the resource http://localhost/sample_pie.php, and thus the operation timed out. Try to access it through the browser.
这意味着 PHP 无法访问资源http://localhost/sample_pie.php,因此操作超时。尝试通过浏览器访问它。
回答by user10189012
I was using ffmpeg and there is video uploading and ffmpeg copies some files on temp and my anti virus program blocks that copying and there is Maximum execution time of 60 seconds exceeded
我正在使用 ffmpeg 并且有视频上传和 ffmpeg 复制一些临时文件,我的防病毒程序阻止复制,并且最大执行时间超过 60 秒
I REMOVED ANT?V?RUS PROGRAM I SAW PROBLEM GONE OFF
我删除了 ANT?V?RUS 程序我看到问题消失了

