php 超过 30 秒的最大执行时间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15903975/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 10:10:01  来源:igfitidea点击:

Maximum execution time of 30 seconds exceeded

phpmysql.htaccess

提问by Alyssa Reyes

Help please! I've been retrieving listing in my system from database. But it has thousand listing until this error appear:

请帮忙!我一直在从数据库中检索系统中的列表。但是在出现此错误之前它有一千个列表:

Fatal error: Maximum execution time of 30 seconds exceeded

致命错误:超过了最长 30 秒的执行时间

This code is from my htaccess

这段代码来自我的 htaccess

php_value max_execution_time 3000
php_value upload_max_filesize 512M
php_value post_max_size 512M
php_value memory_limit 256M
php_value set_time_limit 0

How can I resolve this? I'm using PHP and MYSQL.

我该如何解决这个问题?我正在使用 PHP 和 MYSQL。

回答by Mayukh Roy

you could extend the maximum execution time like this:

您可以像这样延长最大执行时间:

ini_set('max_execution_time', 0); 

else edit your htaccess

否则编辑您的 htaccess

php_value max_execution_time 0

回答by chandresh_cool

Add this in top of your php file

将此添加到您的 php 文件顶部

ini_set("max_execution_time", 0);

回答by Nanhe Kumar

If running php using command line interface (CLI) use:

如果使用命令行界面 (CLI) 运行 php,请使用:

ini_set('max_execution_time', -1);

else run :

否则运行:

ini_set('max_execution_time', 0);

回答by amitwalia23

The same error we face in wordpress site

我们在 wordpress 网站中面临的同样错误

we made changes in the .htaccess but it didn't work.

我们对 .htaccess 进行了更改,但没有用。

Then we created one php.ini file interred this code and uploaded to root directory

然后我们创建了一个 php.ini 文件并将这段代码上传到根目录

max_execution_time = 60

and it fixed the issue.

它解决了这个问题。

回答by Shesha

At the top of the file set the timeout:

在文件的顶部设置超时:

set_time_limit(0);