php - 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 推送该数据。如果插入的行数较少,则它正在工作。
解决方案
似乎问题与从结果中获取的许多记录有关,您能否在 SQL 查询中应用限制为 2 并检查一次。
推荐阅读
- wordpress - 无效的分类 Wordpress
- android - 如何修复“[Dagger/MissingBinding]:没有@Provides-annotated 方法就无法提供”
- angular - 使用 observable 触发多个 API 调用
- javascript - Javascript 表单交叉引用项
- flutter - 如何在flutter中连续图像下方添加标签并在flutter中添加卡片
- android - 7 英寸平板电脑中的图标太小
- java - 在 java 中使用 JAXB 将 xml 解组为模态类失败
- java - 为什么我从 jquery ajax 调用作为整个 html 页面而不只是 JSON 对象得到响应
- windows - 如何在 Windows 中使用 shell 脚本永久设置环境变量
- symfony - 使用带有验证器的 Vich Uploader 添加图像时,imageName 为 null