如何设置 PHP 脚本的最长执行时间? [英] How can I set the maximum execution time for a PHP script?

查看:39
本文介绍了如何设置 PHP 脚本的最长执行时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改 PHP 脚本的最长执行时间.在我尝试过的脚本中

I would like to change the maximum execution time for a PHP script. In the script I have tried

ini_set("max_execution_time", "1000");

set_time_limit(1000);

一起和分开.

我还将这一行添加到 .htaccess 中:

I also added this line to .htaccess:

php_value max_execution_time 1000

php.ini 已关闭安全模式并且 Apache 服务器具有标志 AllowOverride All.我必须做什么才能让服务器允许更长的执行时间?

php.ini has safemode off and the Apache server has the flag AllowOverride All. What must I do to get the server to allow a longer execution time?

推荐答案

在 ini 文件中设置变量对我有用:

Setting the variable in the ini file works for me:

max_execution_time = 1000;

set_time_limit() 应该也能工作,只要它不在安全模式下.

set_time_limit() should work as well, as long as it's not in safe mode.

这篇关于如何设置 PHP 脚本的最长执行时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆