在尝试从外部访问index.php时出现404错误

After extensive search, double checking install, reinstalling, troubleshooting, I don't know where to turn next.

Background:

  • I'm trying to get a wiki working using MediaWiki.
  • I have PHP Manager installed for IIS 7.
  • I have a MySQL server installed on the same machine.
  • PHP version is 5.6.5 and installed at C:\PHP.

The main issue: Locally I can view the index.php file, but not externally.

I get a generic page can't be displayed error if linking to the /w/ directory.

Depending on the browser I'll get two results when linking to w/index.php:

  1. page can't be displayed
  2. IIS 404.0 Error.

Depending on the browser I'll get two results linking to w/index.php?title=Main_Page;

  1. IIS 404.0 Error
  2. unformatted page content

The error:

Module: IIS Web Core
Notification: MapRequestHandler
Handler: StaticFile
Error Code: 0x80070002
Requested URL: http://localhost:80/w/index.php?title=Main_Page
Physical Path: C:\inetpub\wwwroot\w\index.php
Logon Method: Anonymous
Logon User: Anonymous

Troubleshooting done:

  • No errors shown by PHP Manager.
  • Switched PHP versions (no effect).
  • Externally tested other PHP forms running inside HTML (works fine).
  • Checked permissions on all folders (fine).
  • Edited Feature Permissions under Handler Mappings to allow executable (no change).
  • Changed PHP_via_FastCGI's access restriction to execute (no change).
  • Checked to make sure PHP Handling Mapping was set to *.php (it is).
  • Checked Default Document settings and index.php. Externally tested index.html in w/ (works both by direct link to file and link to folder).
  • Externally tried tested /w/index.html with PHP "Hello World" inside it (blank page).

What am I doing wrong? Everything works perfectly fine run locally on the server.

As Christpher says, localhost is a wrong in an URL to be contacted from outside: if that's what you see, you forgot to set $wgServer correctly.