PHP error guide

Apache AH01071 Primary script unknown: meaning and fix

Error summary

Correct ProxyPassMatch or SetHandler path mapping and filesystem access. Mod_proxy_fcgi forwards a filename FPM cannot resolve.

What it means

Correct ProxyPassMatch or SetHandler path mapping and filesystem access. Mod_proxy_fcgi forwards a filename FPM cannot resolve.

What the error means

This message means that mod_proxy_fcgi forwards a filename FPM cannot resolve. The exact signature distinguishes apache ah01071 primary script unknown from a generic application failure.

Why PHP produces it

The engine or service reports “Apache AH01071 Primary script unknown” because its required precondition was not met. Correct ProxyPassMatch or SetHandler path mapping and filesystem access.

PHP version notes

The apache ah01071 primary script unknown wording here is based on Current PHP-FPM, Apache 2.4, or nginx; punctuation and exception class names can differ on older branches or vendor builds.

Most common causes

  • The immediate input or configuration reaches the specific condition: mod_proxy_fcgi forwards a filename FPM cannot resolve
  • The code path assumes the prerequisite for apache ah01071 primary script unknown has already been satisfied.
  • For apache ah01071 primary script unknown, development and production differ in version, extension, permissions, paths, or service configuration.
  • An earlier operation returned an unchecked value that is consumed by the line reporting apache ah01071 primary script unknown.

Minimal examples

BAD — reproduces the problem

apache
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1/wrong/$1

FIXED — safer pattern

apache
<FilesMatch "\.php$">
 SetHandler "proxy:unix:/run/php/app.sock|fcgi://localhost/"
</FilesMatch>

Step-by-step diagnosis

  1. Copy the complete “AH01071: Got error 'Primary script unknown'” text and retain the first application stack frame.
  2. Reproduce apache ah01071 primary script unknown in the same SAPI and environment listed for this page.
  3. Before changing apache ah01071 primary script unknown, inspect the preceding value or directive and verify its type, path, version, and permissions.
  4. Apply the narrow correction—correct ProxyPassMatch or SetHandler path mapping and filesystem access—then repeat the original request once.

Fixes

Correct the failing prerequisite

Correct ProxyPassMatch or SetHandler path mapping and filesystem access

apache
<FilesMatch "\.php$">
 SetHandler "proxy:unix:/run/php/app.sock|fcgi://localhost/"
</FilesMatch>

Fail explicitly at the boundary

Validate the condition before the operation that emits apache ah01071 primary script unknown, and log a safe diagnostic without credentials or full production paths.

Common mistakes when fixing it

  • Suppressing apache ah01071 primary script unknown instead of correcting its upstream condition.
  • Testing apache ah01071 primary script unknown only with the CLI binary when the failing request runs under FPM or Apache.
  • Changing a global setting for apache ah01071 primary script unknown before confirming the site-specific effective configuration.

How to prevent it

  • Add a focused test that exercises the boundary responsible for apache ah01071 primary script unknown.
  • Keep runtime versions, extensions, configuration, and deploy artifacts affecting apache ah01071 primary script unknown reproducible.
  • Validate external data and service return values before they can trigger apache ah01071 primary script unknown.

Web server / environment notes

fpm, apache, linux. The failure occurs where mod_proxy_fcgi forwards a filename FPM cannot resolve

Tags: fpm,apache,linux

Categories