phpinfo
phpinfo(int $flags = INFO_ALL): true
Dumps a full introspection report of the current PHP (config, extensions, env vars, license, ...), section-selectable via INFO_* constants.
C C23
#include <stdio.h>
int main(void) {
/* C has no runtime introspection: the closest is compiler-predefined macros (all compile-time facts) */
printf("std c: %d\n", __STDC__);
printf("hosted: %d\n", __STDC_HOSTED__);
return 0;
}
std c: 1 hosted: 1
C++ C++26
#include <iostream>
int main() {
// C++ same as C: no runtime introspection; the closest is the language standard macro (always 202400 under -std=c++26)
std::cout << "cplusplus: " << __cplusplus << "\n";
std::cout << "hosted: " << __STDC_HOSTED__ << "\n";
return 0;
}
cplusplus: 202400 hosted: 1
C# v11.0.100
// .NET has no phpinfo-style full-table introspection: Environment/RuntimeInformation only give scattered facts,
// and their concrete values drift with the environment — print only boolean derived facts
Console.WriteLine($"cpus detectable: {Environment.ProcessorCount > 0}");
Console.WriteLine($"64-bit process: {nint.Size == 8}");
cpus detectable: True 64-bit process: True
Go v1.27.4
package main
import (
"fmt"
"runtime"
)
func main() {
// Go has no phpinfo-style introspection: the runtime package only gives scattered facts;
// concrete values of runtime.Version()/GOARCH drift with the environment — print only boolean derived facts
fmt.Println("cpus detectable:", runtime.NumCPU() > 0)
fmt.Println("arch known:", runtime.GOARCH != "")
}
cpus detectable: true arch known: true
Java v27.0.1
import java.util.Properties;
public class Main {
public static void main(String[] args) {
// Java has no phpinfo-style introspection: System.getProperties() (the full JVM system-property table) is the closest counterpart
Properties props = System.getProperties();
System.out.println("non-empty: " + !props.isEmpty());
System.out.println("java.version key present: " + props.containsKey("java.version"));
}
}
non-empty: true java.version key present: true
JavaScript v26.13.1
// Node has no phpinfo-style full-table introspection: process.versions (the runtime version family) is the closest counterpart —
// concrete version values drift with the environment; print only "existence" derived facts
console.log("node version exposed:", typeof process.versions.node === "string");
console.log("v8 version exposed:", typeof process.versions.v8 === "string");
node version exposed: true v8 version exposed: true
PHP v8.6.0
// phpinfo: the introspection flagship — dumps massive output drifting with version/environment; forbidden in production.
// Determinism strategy: capture via output buffering, print only stable derived facts, never echo the raw dump
ob_start();
phpinfo(INFO_LICENSE); // INFO_* constants fetch info by section (the LICENSE section is the most stable)
$captured = ob_get_clean();
echo "captured non-empty: ", $captured !== "" ? "yes" : "no", "\n";
echo "mentions License: ", str_contains($captured, "License") ? "yes" : "no", "\n";
// PHP 8.6 switched the license to BSD-3-Clause (≤8.5 shipped PHP License 4.01) —
// a living lesson in why the raw phpinfo dump must never be asserted against
echo "php still credited: ", str_contains($captured, "PHP") ? "yes" : "no", "\n";
captured non-empty: yes mentions License: yes php still credited: yes
Python v3.15.2
import sys
# Python has no phpinfo-style introspection: sys.modules (the loaded-module table) is one scattered entry point,
# help() is the interactive documentation entry — equally voluminous and version-drifting output; never print it directly in production code
import json
print("json module loaded:", "json" in sys.modules)
print("modules loaded:", len(sys.modules) > 0)
json module loaded: True modules loaded: True
Rust v1.99.1
fn main() {
// Rust has no runtime introspection: compile-time facts (size_of/cfg!) are the entire capability ceiling,
// no global config table to enumerate — these two 8s are compile-time constants too, only demonstrating the boundary of "introspection"
println!("usize bytes: {}", std::mem::size_of::<usize>());
println!("pointer bytes: {}", std::mem::size_of::<*const u8>());
}
usize bytes: 8 pointer bytes: 8
TypeScript v26.13.1
// Node has no phpinfo-style full-table introspection: process.versions (the runtime version family) is the closest counterpart —
// concrete version values drift with the environment; print only "existence" derived facts
console.log("node version exposed:", typeof process.versions.node === "string");
console.log("v8 version exposed:", typeof process.versions.v8 === "string");
node version exposed: true v8 version exposed: true
Language differences
C: no runtime introspection — the closest thing is compiler predefined macros (__STDC__/__STDC_HOSTED__, all compile-time facts); environment info means getenv or hand-reading /proc.
C++: same as C (predefined macros + std::getenv); nothing in the standard library.
C#: Environment (ProcessorCount, ...) plus RuntimeInformation give scattered facts — there is no phpinfo-style master table.
Go: the runtime package offers scattered facts (NumCPU/GOARCH/Version); no full config introspection.
Java: System.getProperties() (the JVM system-properties table) is the closest cousin — one fully enumerable Properties object.
JavaScript: Node has no phpinfo-style table; the process object (versions/env/arch/platform) is a collection of scattered facts.
PHP: phpinfo is the introspection flagship — INFO_* constants select sections (GENERAL/CONFIGURATION/MODULES/ENVIRONMENT/VARIABLES/LICENSE); it must be disabled in production: it leaks the doc root, extension list, exact versions and env vars (including secrets), and is an attacker's first recon stop; its output is inherently unstable (PHP 8.6 replaced the old PHP License 4.01 with BSD-3-Clause), so assert only derived facts.
Python: no equivalent — sys.modules (loaded-module table), sys.version and help() are scattered entry points; assembling the full picture is the platform module's job.
Rust: no runtime introspection — compile-time facts (size_of/cfg!/option_env!) are the whole story; no global config to enumerate.
TypeScript: same as JavaScript (the process object); browsers deliberately expose no runtime details.