首页 > 解决方案 > php wamp服务器中的网关超时错误

问题描述

我在长时间运行的 php 脚本中遇到超时错误。我尝试使用以下代码设置执行时间:

ini_set('max_execution_time', 1200);

我也尝试在 apache conf 文件中设置 max_execution_time。但是问题没有解决。仍然有同样的问题。脚本中有一个 Firebase 云消息模块,可以将一些数据推送到 Android 设备。当我评论这部分代码时。网关超时错误未显示。但该代码在脚本中很重要,不能评论。这可能是什么原因?谁能帮我解决这个问题?

  if ($result->num_rows > 0) {
                        // output data of each row
                        while($row = $result->fetch_assoc()) {
                          $deviceid=$row["id"];
                          $regId=$row["regid"];
                        if($regId != null){
                          $json = $push->getPush();
                          $response = $firebase->send($regId, $json);
                        }

                        }
                    }

该脚本实际上在表中插入了太多行并使用 fcm 推送该数据。如果插入的行数较少,则它正在工作。

标签: phpandroidfirebase-cloud-messagingwampservertimeoutexception

解决方案


似乎问题与从结果中获取的许多记录有关,您能否在 SQL 查询中应用限制为 2 并检查一次。


推荐阅读