简体   繁体   English

php代码返回致命错误

[英]Php Code returns fatal error

I have developed a program in PHP which opens IE on a button click. 我用PHP开发了一个程序,单击该按钮即可打开IE。 I have used the function 我已经使用了功能

system("C:\Program Files\Internet Explorer\IE.EXE");

But then after successful program execution I get the error: 但是在成功执行程序后,我得到了错误:

Fatal error: Maximum execution time of 60 seconds exceeded 致命错误:超过60秒的最大执行时间

Why does this happen? 为什么会这样?

you need to up the max execution time 您需要增加最大执行时间

void set_time_limit ( int $seconds )

http://php.net/manual/en/function.set-time-limit.php http://php.net/manual/zh/function.set-time-limit.php

but what you should really do is have the php script start a batch script which starts ie and then returns immediately. 但是,您真正应该做的是让php脚本启动一个批处理脚本,该脚本先启动ie,然后立即返回。 You don't want the php script to wait before ie is done execution. 您不希望php脚本在执行完成之前等待。

maybe something like 也许像

system("start iexplore");

by default php has a 60 second time limit on scripts running (incase you create an infinite loop or other things like that) so they dont keep running forever 默认情况下,php对脚本的运行有60秒的时间限制(以防您创建无限循环或类似的东西),因此它们不会永远运行

often long running database queries can easily exceed 60sec 通常长时间运行的数据库查询可以轻松超过60秒

if your script does need more then 60secs and is working as expected, then you can use set_time_limit(n) where n = number of seconds. 如果您的脚本确实需要60秒以上的时间并且可以正常工作,则可以使用set_time_limit(n),其中n =秒数。 so 1 hour would be set_time_limit(3600) 所以将1小时设为set_time_limit(3600)

http://php.net/manual/en/function.set-time-limit.php http://php.net/manual/zh/function.set-time-limit.php

also as noted in the php manual (for system() function) 也如php手册中所述(对于system()函数)

If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. 如果使用此功能启动程序,则要使其在后台继续运行,必须将程序的输出重定向到文件或其他输出流。 Failing to do so will cause PHP to hang until the execution of the program ends. 否则,PHP会挂起,直到程序执行结束。

I would expect, this is what is happening for you 我希望这就是您正在发生的事情

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM