{"record":{"id":"be6b142abd90a9b3","repo":"composer/composer","slug":"composer-2-3-0-dropped-support-for-autoloading-on","errorCode":null,"errorMessage":"Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running {php_version}, please upgrade PHP or use Composer 2.2 LTS via \"composer self-update --2.2\". Aborting.","messagePattern":"Composer 2\\.3\\.0 dropped support for autoloading on PHP <5\\.6 and you are running (.+?), please upgrade PHP or use Composer 2\\.2 LTS via \"composer self-update --2\\.2\"\\. Aborting\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"src/Composer/Autoload/AutoloadGenerator.php","lineNumber":996,"sourceCode":"\n        return <<<AUTOLOAD\n<?php\n\n// autoload.php @generated by Composer\n\nif (PHP_VERSION_ID < 50600) {\n    if (!headers_sent()) {\n        header('HTTP/1.1 500 Internal Server Error');\n    }\n    \\$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via \"composer self-update --2.2\". Aborting.'.PHP_EOL;\n    if (!ini_get('display_errors')) {\n        if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {\n            fwrite(STDERR, \\$err);\n        } elseif (!headers_sent()) {\n            echo \\$err;\n        }\n    }\n    throw new RuntimeException(\\$err);\n}\n\nrequire_once $vendorPathToTargetDirCode;\n\nreturn ComposerAutoloaderInit$suffix::getLoader();\n\nAUTOLOAD;\n    }\n\n    /**\n     * @param string $vendorPathCode unused in this method\n     * @param string $appBaseDirCode unused in this method\n     * @param string $prependAutoloader 'true'|'false'\n     * @return string\n     */\n    protected function getAutoloadRealFile(bool $useClassMap, bool $useIncludePath, ?string $targetDirLoader, bool $useIncludeFiles, string $vendorPathCode, string $appBaseDirCode, string $suffix, bool $useGlobalIncludePath, string $prependAutoloader, bool $checkPlatform)\n    {\n        $file = <<<HEADER","sourceCodeStart":978,"sourceCodeEnd":1014,"githubUrl":"https://github.com/composer/composer/blob/6ffc1177404d0c50119c22dde6564a380f4a82c9/src/Composer/Autoload/AutoloadGenerator.php#L978-L1014","documentation":"This is generated source code: AutoloadGenerator writes this RuntimeException into vendor/autoload.php, and it is thrown at runtime when that generated autoloader is required on a PHP version below 5.6. Composer 2.3.0+ relies on PHP 5.6+ language features, so the generated autoloader refuses to run on older runtimes and sends a 500 header if in a web context.","triggerScenarios":"Deploying an application whose dependencies were installed with Composer 2.3+ onto a server running PHP 5.5 or earlier, then including vendor/autoload.php. The throw occurs in the generated autoloader, not in the Composer binary.","commonSituations":"Legacy hosting with old PHP; CI/build image using a newer PHP than the production runtime; CI installing with Composer 2.3 but deploying to a PHP 5.5 box.","solutions":["Upgrade the runtime PHP to 5.6 or newer (recommended).","Downgrade Composer to 2.2 LTS on the build machine with `composer self-update --2.2` so the generated autoloader stays 5.x compatible.","Align build and production PHP versions so the generated autoloader targets a supported runtime."],"exampleFix":"// before (build with Composer 2.3, deploy to PHP 5.5)\ncomposer install  # generates autoloader requiring PHP >= 5.6\n\n// after\ncomposer self-update --2.2\ncomposer install  # generates a 5.x-compatible autoloader","handlingStrategy":"fallback","validationCode":"if (PHP_VERSION_ID < 50600) { throw new \\RuntimeException('PHP < 5.6 is unsupported by this autoloader; use Composer 2.2 LTS to generate it.'); }","typeGuard":"function autoloadCompatiblePhp(): bool { return PHP_VERSION_ID >= 50600; }","tryCatchPattern":"try { require __DIR__ . '/vendor/autoload.php'; } catch (\\RuntimeException $e) { http_response_code(500); error_log($e->getMessage()); // fall back to 2.2-generated autoloader or upgrade PHP exit(1); }","preventionTips":["Keep build and production PHP versions aligned.","If production must stay on PHP 5.5, generate the autoloader with Composer 2.2 LTS (`composer self-update --2.2`).","Add a deployment smoke-test that requires the generated autoloader on the target PHP."],"tags":["composer","autoload","php-version","compatibility","runtime"],"analyzedSha":"6ffc1177404d0c50119c22dde6564a380f4a82c9","analyzedAt":"2026-08-07T00:01:08.491Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}