BreachHunter
Pricing Blog Log inSign up
● thermal huntscan engines onlineassessment only — no exploits
  1. Home
  2. Blog
  3. phpinfo() in Production: The Diagnostic Page That Maps Your Server for Attackers

Guides · ← All guides

phpinfo() in Production: The Diagnostic Page That Maps Your Server for Attackers

Published: November 14, 2026 · Last reviewed: November 14, 2026 · 7 min read

By the Ingenious AI team

The short answer: phpinfo() is a one-line diagnostic that prints everything about your PHP environment: exact version, loaded modules, file paths, configuration values, and environment variables — which on real servers include credentials passed through the environment. It is meant for a developer's eyes during setup. Left in production, BreachHunter rates an exposed phpinfo page HIGH (8 points), with the table's explanation: it “discloses PHP version, paths, and environment variables — a roadmap for attackers.” The fix is deletion, not protection: the file should not exist on a production server.

Run a free BreachHunter assessment on your site →

There is a specific archaeology to this finding. During setup or a debugging session, someone creates info.php or phpinfo.php, confirms the configuration, and means to delete it. The deployment ships. The file — small, quiet, never linked — waits. Years later a scanner asks for it by name, because scanners always ask, and the server answers with the most complete self-description it publishes anywhere.

This guide covers what an attacker does with each section of the output (version targeting, path disclosure, environment secrets), why “but nobody knows the URL” fails (the name list is short and public), and the environment hygiene — display_errors off, diagnostics gated — that keeps the next debugging session from repeating it.

What does an attacker do with phpinfo output?

Start at the top: the exact PHP version converts the public CVE database into a personal menu — the same version-targeting problem as server banners, except phpinfo adds the loaded-extension list, so the menu is filtered to what is actually installed. Then the paths: document root, include paths and temp directories turn later attacks (file inclusion, upload handling, log poisoning) from exploration into arithmetic.

The environment section is the sleeper. Servers that receive secrets through environment variables — database URLs, API keys, session secrets — print them here in full. At that point phpinfo stops being reconnaissance and becomes the credential leak itself, joining the .env class of incidents: rotate what it showed. Even without secrets, the page confirms the operating system, the web server API and the disable_functions list — a precise statement of what the attacker need not bother trying.

Why deletion, and what replaces it in a real debugging session?

Some findings are fixed by configuration; this one is fixed by absence. There is no production use case for a public page that dumps the environment — every legitimate need (checking a version, confirming an extension) is served better by the command line (php -v, php -m) or a log-gated admin tool. Password-protecting the page is the common half-measure and the wrong one: it leaves a high-value file behind a single credential on the public internet, forever on the probe lists.

The process fix is to make the file unshippable: deployment pipelines that exclude diagnostic filenames by pattern (phpinfo*, info.php, test.php), and a production configuration with display_errors off so PHP itself stops volunteering stack traces and paths on error pages — the same information-disclosure family the web audit checks. The scanner retest is trivially binary: the URL returns 404, or it does not.

Worked example: juniperinteriors.example

Juniper Interiors, a design studio with a PHP-based portfolio and client portal, had its phpinfo page created during a 2023 hosting migration to verify the new server's PHP version. It verified it for everyone, for three years:

GET /phpinfo.php -> 200
  PHP Version: 8.0.30 (EOL branch)
  DOCUMENT_ROOT: /var/www/juniperinteriors/public
  env: DB_HOST, DB_NAME, DB_USER visible; DB_PASS present in environment block

Because the environment block printed real database credentials, the response ran as a credential exposure: DB password rotated, the file deleted, and the deploy pipeline given an exclusion list for diagnostic names. The migration checklist got one new line — “diagnostics live on the staging box, never in the shipped tree” — and the studio's retest showed 404 with the PHP version now undisclosed anywhere public. The HIGH finding's 8 points returned, but the owners cared more about the sentence in the retest: nothing on the public site describes the server anymore.

The five actions to take

Removing diagnostic exposure from production:

  1. Probe for phpinfo.php, info.php, test.php and similar names on every vhost — then delete, never just rename or protect.
  2. If the page was reachable, inventory what it printed (especially environment variables) and rotate any credential it exposed.
  3. Set display_errors off in production PHP so errors stop publishing paths and traces.
  4. Add diagnostic filenames to the deploy exclusion list so the file cannot ship again.
  5. Re-scan to confirm 404s across all probed diagnostic paths.

Run a free BreachHunter assessment on your site →

Frequently asked questions

We renamed ours to something obscure. Is that safe?

Safer than phpinfo.php, still not safe: obscure names leak through logs, referrers, repo history and directory probing, and the file's value to an attacker justifies patience. The control that works is absence. Rename plus delete-the-habit beats rename alone — but deletion beats both.

Is phpinfo exposure really HIGH if there are no secrets in the environment?

The scanner rates the standard case HIGH because the version-plus-modules-plus-paths package is a genuine attack roadmap, and the scanner cannot know from outside whether your environment section holds secrets. If yours does, the real severity is higher than the label.

What about other frameworks' diagnostic pages?

The pattern generalizes: framework debug toolbars, /_profiler, /actuator/env, server-status pages. Each ecosystem has a “developer X-ray” that must not survive to production — several have their own rows in the scanner's sensitive-path table.

How do developers check PHP config without the page?

From the shell: php -v, php -m, php --ini, or a CLI one-liner printing the single value in question. On shared hosting without shell access, create the page, read it, delete it in the same session — and let the deploy exclusion list be the backstop.

Could our host have created this file?

Some control panels and migration tools do generate diagnostic pages. That changes the conversation with your host, not the fix: delete it, and add the post-migration probe to your checklist so the next migration's leftovers get caught by you first.

Sources

Where this guide's claims come from, in citable form:

  • PHP manual — phpinfo() (2025) — the function's own page, including what it prints.
  • OWASP Web Security Testing Guide (2021) — fingerprinting web application framework test cases.
Share this: X · Facebook · LinkedIn · WhatsApp

Related guides

  • Website Security Test: What It Checks, What It Misses, and How to Read Yours · 9 min read
  • Website Security Cheat Sheet: Headers, TLS, Cookies and Exposed Files · 7 min read
  • What a Website Security Assessment Actually Tests · 10 min read
  • TLS/SSL Basics: What Your Certificate Says About Your Site · 8 min read
  • Common Website Misconfigurations (and How to Fix Them) · 11 min read
  • Reading Your First Pentest Report: From Score to Action · 9 min read
  • Deleted ≠ Gone: What the Wayback Machine Keeps After You Delete Your Secrets · 9 min read
  • SQL Injection in Plain English: How One Login Box Can Read Your Database · 9 min read
  • What Does a Website Security Scan Check? · 8 min read
  • Exposed .git Directory: What It Leaks and How to Check · 7 min read
  • Security Headers Missing? What Each Header Stops · 7 min read
  • How Much Does a Penetration Test Cost in 2026? · 7 min read
  • Website Security Checklist for Small Teams (60-second self-check) · 6 min read
  • Reading Your Scan Results: Which Findings Fix First? · 7 min read
  • Content-Security-Policy Missing: What CSP Does and How to Add It Safely · 8 min read
  • HSTS Missing: What Strict-Transport-Security Prevents · 7 min read
  • Clickjacking and X-Frame-Options: How Framing Attacks Work · 7 min read
  • Cookie Flags Explained: Secure, HttpOnly and SameSite · 8 min read
  • Exposed .env File: What Leaks, What Attackers Do Next, What You Do First · 8 min read
  • Directory Listing Enabled: What It Shows Attackers and How to Disable It · 7 min read
  • Mixed Content: Why Your HTTPS Page Still Loads Insecure Resources · 7 min read
  • Expired SSL Certificate: What Breaks, Why Renewal Fails, and How to Catch It Early · 7 min read
  • TLS 1.0 and 1.1 Still Enabled: Why Old Protocols Show Up as a Finding · 7 min read
  • Open Ports on a Web Server: Which Ones Should Never Face the Internet · 8 min read
  • No SPF or DMARC Record: How Missing Email Auth Exposes Your Website · 7 min read
  • Subdomain Takeover: How a Dangling DNS Record Lets Attackers Claim Your Name · 7 min read
  • Forgotten Subdomains: The Staging Site You Forgot Is Still Public · 7 min read
  • WordPress Security Scan: The Exposures an Assessment Finds on WordPress Sites · 8 min read
  • Exposed Backup Files: .bak, .old and .zip Files Sitting in Your Web Root · 7 min read
  • Server Version Banners: Why Your Headers Point Attackers to the Right Exploit · 7 min read
  • End-of-Life Software: Running a Server Stack Nobody Patches Anymore · 7 min read
  • CORS Misconfiguration: When Cross-Origin Sharing Opens Your Data to Any Site · 7 min read
  • Open Redirect Vulnerability: How Your Own Domain Sends Visitors to a Phishing Page · 7 min read
  • Dangerous HTTP Methods: What TRACE, PUT and DELETE Should Never Answer · 7 min read
  • Host Header Injection: Poisoned Reset Links and Cache Attacks Explained · 7 min read
  • What Is security.txt? The Small File That Lets Researchers Reach You · 6 min read
  • Admin Panel Exposed to the Internet: What an Assessment Flags and Why · 7 min read
  • phpMyAdmin Exposed: Why This Database Door Is a Prime Brute-Force Target · 7 min read
  • Spring Boot Actuator Exposed: Environment Dumps, Heap Leaks and Shutdown Endpoints · 7 min read
  • Debug Console in Production: The Finding That Can Become Code Execution · 7 min read
  • Exposed AWS Credentials File: The /.aws/credentials Finding, Explained · 7 min read
  • Referrer-Policy and Permissions-Policy: The Two Quiet Headers You Are Probably Missing · 6 min read
  • Exposed package.json: Your Dependency List Is a Recon Gift · 6 min read
  • DNS Zone Transfer Open (AXFR): Handing Out Your Entire DNS Map · 6 min read
  • Certificate Name Mismatch: Why the Cert Does Not Match Your Domain · 6 min read
  • Website Security Assessments for Agencies: Checking Every Client Site Without a Security Team · 8 min read
  • SaaS Security Questionnaires: What Buyers Check About Your Website First · 8 min read
  • Ecommerce Website Security: The Exposures That Put Your Checkout at Risk · 8 min read
  • Small Business Website Security: The Checks That Matter at Your Size · 7 min read
  • How to Prepare for a Website Security Assessment (and Read the Report Calmly) · 7 min read
  • Vulnerability Severity Explained: What Critical, High, Medium and Low Actually Mean · 7 min read
  • Retest After Fixes: How to Prove a Security Finding Is Actually Closed · 7 min read
  • Security Assessment vs Vulnerability Scan vs Pentest: What Is the Difference? · 7 min read
  • How Long Does a Website Security Scan Take? · 6 min read
  • Website Security Drift: Why Last Month's Clean Scan Is Already Out of Date · 7 min read
  • WordPress Site Keeps Getting Hacked After Cleanup · 8 min read
  • Google Blacklist Removal: Getting the Red Warning Off Your Site · 8 min read
  • VirusTotal Flagged My Site: How to Clear a False Positive · 8 min read

Related from the Ingenious AI suite

  • Ingenious AI — the full suite of security and compliance tools
  • DomainGuard — domain impersonation and typosquat defense
  • See BreachHunter pricing →
BreachHunter · by Ingenious AI · read-only security assessment — scan only targets you own or are authorized to test
About · Contact · Blog · vs Intruder · Privacy · Terms · Security · Threats · Nextcloud Check · Verify Evidence · Help · Redeem
More from Ingenious AI:
DisclosureGuard — AI disclosure compliance · Vibe-Code Audit — AI code security scanner · Rogue-Agent Defense — AI agent firewall · ChatBreaker — AI chatbot red-teaming · ModelMinder — AI model deprecation radar · TermsWatch — AI vendor terms monitor · Agent Flight Recorder — tamper-evident agent audit trails · Agent Auth Gateway — agent credentials & kill switch · DomainGuard — domain impersonation defense · Agent Passport — Know-Your-Agent registry · AgentGate — agent policy publisher · AgentBlock — AI agent & crawler access control · BoundaryVault — agent log forensics · Agentic Receipts — verifiable agent payment receipts · EvalEgress — eval-to-production exposure scan · HomeShield MCP — home AI server exposure check · WireWatch — payment verification ceremony · ADMT Notice Kit — AI decision notice compliance · DueLadder — human-approved invoice chasing · Agent-Ready Store Audit — can AI agents buy from your store · ContentCraft AI — content operations · AgentReady — agent-readiness checks · AI Audit Exchange — AI audit exchange · CallbackShield — callback & webhook protection · CompanionGuard — AI companion safety guardrails · CRAClock — EU Cyber Resilience Act deadline clock · EInvoice Translator — e-invoice format translator · GEOFixer — geo & local listing fixes · MandateGuard — agent spending mandates · OutcomeMeter — AI outcome measurement · ProvenanceGuard — content provenance checks · ReviewDesk — review response desk · ReviewProof — verified review evidence · TakedownCoop — coordinated phishing takedowns · TrustGate — trust & safety gating · BreachHunter — website penetration testing · All 36 platforms — the Ingenious AI portfolio

We use cookies. Necessary cookies keep the site working. With your permission we also use analytics cookies (to understand usage) and marketing cookies (for ads). Read our privacy policy.

NecessaryRequired for login, security and core features. Always on.
AnalyticsHelps us understand which pages are useful.
MarketingUsed for advertising and measuring ad performance.

    No match. Try “pricing”, “php2shell” or “contact” — or press Esc to close.

    ↑↓ navigate · Enter open · Esc close