php / php/php-src

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

Open
#18,548 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Category: DNS Extension: standard
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the checkdnsrr('google.com', 'A') result with PHP 8.4.7 in both CLI and mod_php on macOS, using the provided command and example. Compare the two execution environments to identify why DNS lookup behavior differs; done means the same lookup produces the expected true result in mod_php.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, php
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.