dongzouqie4220 2015-07-13 19:24
浏览 120

PHP意外终止脚本

I'm working in PHP and creating a system with a lot of PHP-driven elements and I have noticed that some of my pages stop displaying text produced using the echo command.

I have made a small example of this. Of course, my program is not supposed to just print allt numbers from 1 to 10000, but this example demonstrates how the script just terminates without any warnings.

Example code:

<?php
    for ($i = 1; $i <= 10000; $i++) {
        echo $i, '<br>';
    }
?>

Output:

1
2
More numbers...
8975
8976
8977
8

What is causing this? Is it a buffer issue, and how do I resolve it?

  • 写回答

3条回答 默认 最新

  • douju7245 2015-07-13 19:49
    关注

    The fact that your code ran to completion on the cli suggests to me that your script is exceeding the ini.max_execution_time runtime configuration.

    Note in the linked documentation that the value of this configuration on the cli is 0 which means it does not time out when run in that environment.

    The default setting in the browser is 30 seconds.

    You can show your current setting in the browser with:

    echo ini_get('max_execution_time');
    

    And you should be able to increase it with:

    ini_set('max_execution_time', 0); // turns off timeout
    
    评论

报告相同问题?

悬赏问题

  • ¥20 关于多单片机模块化的一些问题
  • ¥30 seata使用出现报错,其他服务找不到seata
  • ¥35 引用csv数据文件(4列1800行),通过高斯-赛德尔法拟合曲线,在选取(每五十点取1点)数据,求该数据点的曲率中心。
  • ¥20 程序只发送0X01,串口助手显示不正确,配置看了没有问题115200-8-1-no,如何解决?
  • ¥15 Google speech command 数据集获取
  • ¥15 vue3+element-plus页面崩溃
  • ¥15 像这种代码要怎么跑起来?
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection