php / php/php-src

checkdnsrr/dns_check_record works in CLI but not in mod_php on macOS

未关闭
#18,548 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Category: DNS Extension: standard
主要语言
C
星标
40.4k
派生
8.1k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

The following code:

<?php
$result = checkdnsrr('google.com', 'A');
var_dump($result);

Resulted in this output:

bool(false)

But I expected this output instead:

bool(true)

3v4l link: https://3v4l.org/mchKq

3v4l also seems unable to get "true" out of this. However, this works fine on my machine:

/opt/homebrew/bin/php -r '$result = checkdnsrr("google.com", "A"); var_dump($result);'

My Rocky 6 production server (yes we're upgrading) also gets true for this code, even in mod_php.

I initially spotted this behavior in 7.4, but verified it's present on 8.4 as well.

PHP Version
PHP 8.4.7 (cli) (built: May  6 2025 12:31:58) (NTS)
Copyright (c) The PHP Group
Built by Homebrew
Zend Engine v4.4.7, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.7, Copyright (c), by Zend Technologies

Here's the top of the mod_php phpinfo() output:

PHP Version 8.4.7

System Darwin Vanessas-MacBook-Pro.local 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:47 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6030 arm64
Build Date May 6 2025 12:31:58
Build System Darwin Sequoia-arm64.local 24.4.0 Darwin Kernel Version 24.4.0: Fri Apr 11 18:33:24 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_VMAPPLE arm64
Build Provider Homebrew
Operating System

macOS Sequoia 15.4.1 on ARM (Apple M3 Pro)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用提供的命令和示例,在 macOS 上分别通过 CLI 和 mod_php 使用 PHP 8.4.7 重现 checkdnsrr('google.com', 'A') 的结果。比较这两个执行环境,以确定 DNS 查找行为不同的原因;当相同的查找在 mod_php 中产生预期的 true 结果时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
macos, php
领域
networking
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。