23

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

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

此代码来自我的 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

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

4

5 回答 5

39

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

ini_set('max_execution_time', 0); 

否则编辑您的 htaccess

php_value max_execution_time 0
于 2013-04-09T14:02:18.207 回答
7

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

ini_set("max_execution_time", 0);
于 2013-04-09T14:02:02.047 回答
2

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

ini_set('max_execution_time', -1);

否则运行:

ini_set('max_execution_time', 0);
于 2013-12-04T14:27:17.247 回答
2

我们在 wordpress 网站中遇到的同样的错误

我们在 .htaccess 中进行了更改,但没有成功。

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

max_execution_time = 60

它解决了这个问题。

于 2017-03-03T01:55:24.193 回答
1

在文件顶部设置超时:

set_time_limit(0);
于 2013-04-09T14:18:21.077 回答