October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Fix a 404 When Accessing phpinfo.php on Apache

A 404 for phpinfo.php usually comes from confusing the filesystem path with the URL path—or from using the wrong Apache virtual host. Verify the active mapping, exact filename, and logs.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If Apache is serving /var/www/html as the hostname’s DocumentRoot, place the file at /var/www/html/phpinfo.php and request https://myservername.com/phpinfo.php. Do not include the server’s filesystem path in the URL. A 404 means the request did not resolve to a file through the mapping used by that virtual host, so you must also verify the active host configuration and the exact filename.

Use the URL path, not the filesystem path

Apache normally maps a request by appending its URL path to the configured DocumentRoot. With a document root of /var/www/html, the mapping is:

Request Filesystem location Apache checks Result
https://myservername.com/phpinfo.php /var/www/html/phpinfo.php Correct URL when that is the active document root
https://myservername.com/var/www/html/phpinfo.php A path beneath the document root, such as /var/www/html/var/www/html/phpinfo.php Usually incorrect

The filesystem prefix is therefore not ordinarily repeated in the browser address. The Apache 2.4 documentation describes this default URL-to-file mapping, while also noting that virtual-host configuration can change the root used for a request.

Why /phpinfo.php can still return 404

The hostname may use another document root

Apache can assign a different DocumentRoot to each virtual host. The fact that a file exists in /var/www/html does not prove that myservername.com serves that directory. Have the server administrator inspect the server and virtual-host configuration for the exact hostname you are requesting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An alias or other mapping may be involved

Aliases and related Apache directives can map a URL to a location outside the document root. If the site uses one, the correct URL may not correspond directly to /var/www/html. Check the mapping that handles this hostname before changing the file location.

The filename may not match

The forum question refers to the created file once as phpinfp.php but uses phpinfo.php in the URLs. Confirm the spelling on disk, including every character and the letter case. On a case-sensitive filesystem, phpinfo.php, PHPInfo.php, and phpinfp.php are different names. A directory listing of the mapped directory can rule out this simple cause.

A practical troubleshooting sequence

  1. Confirm the file name. Verify that the file is exactly phpinfo.php, with the expected capitalization.
  2. Confirm the file’s location. Ensure it is inside the directory actually mapped to the requested site, not merely inside a directory that exists on the server.
  3. Verify the active virtual host. Check which Apache virtual-host definition receives myservername.com and read its DocumentRoot and any aliases.
  4. Request the URL relative to that mapping. If the active root is /var/www/html, use https://myservername.com/phpinfo.php. If the configuration maps another URL prefix, use that prefix instead.
  5. Check the server logs with the administrator. If the mapping and spelling are correct but the response remains 404, the request may be reaching a different host definition or another server-side rule may be handling it. The access and error logs can show which resource Apache attempted to resolve.

What a phpinfo page shows

PHP’s phpinfo() function outputs detailed runtime information, including the PHP version, compilation options, loaded extensions, server and environment details, paths, and configuration values. That makes a temporary page useful for checking whether the request is reaching PHP and for diagnosing configuration differences.

Keep the diagnostic page temporary

Because the output is detailed, do not treat a publicly reachable diagnostic page as a permanent site feature. Once you have collected the information, remove the test file or restrict it according to your organization’s security practice.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What the original 404 tells you—and what it does not

A 404 confirms that the resource was not found through the mapping handling that request. It does not, by itself, prove that the file is absent from /var/www/html, that PHP is broken, or that the URL syntax is the only problem. The decisive checks are the active virtual host, its document-root or alias mapping, and the exact on-disk filename.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.