How to install old version of composer

How to install old version of composer

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

How to install old version of composer

Attempting to pin a project to a specific Composer version, such as 1.4.1, often arises when migrating legacy applications or working within a constrained PHP environment that lacks modern extensions. The standard installation script provided by the official repository is dynamic; it downloads and executes the latest stable release by default. When you run the verification command against a hardcoded SHA384 hash intended for a specific version, the script fails because the downloaded installer does not match that fingerprint. This mismatch causes the execution to halt or produce an error, leaving the composer.phar file absent from your filesystem.

The core issue lies in how the installation script calculates dependencies and validates integrity before writing the executable. If you simply run the generic installer without specifying a version, it fetches the current release. To install a legacy version like 1.4.1, you must bypass the default behavior of the installer script and explicitly tell it to download the archive corresponding to that version tag.

The correct approach involves modifying the command line arguments passed to composer-setup.php. Instead of relying on the script's default logic, you need to pass the --install-dir and --filename flags if you want a specific location, but more importantly, you must ensure the script downloads the correct asset. However, the most direct method to install an exact version without creating a custom installer is to download the phar file directly from the GitHub releases for that specific tag.

Here is the precise sequence of commands to achieve this:

  1. Verify PHP Compatibility: Ensure your environment meets the requirements for Composer 1.4.1. This version typically requires PHP 5.3.2 or higher, but often struggles with modern extensions introduced in PHP 7.4 or 8.x that were added after its release. Running this on a brand new PHP 8 server might result in fatal errors regarding missing functions or deprecated behaviors present in the codebase of v1.4.1.

  2. Download the Specific Release: Bypass the installer script entirely and download the pre-built phar file directly from the source. Execute the following command to fetch version 1.4.1 specifically:

    curl -L https://getcomposer.org/installer?version=1.4.1 | php -- --install-dir=/usr/local/bin --filename=composer-1.4.1
    

    Note that the installer script accepts a ?version=X.Y.Z query parameter. This forces the underlying logic to fetch the release matching that tag from the repository before verifying the hash.

  3. Verify Installation: Once the command completes successfully, verify that the binary exists and reports the correct version:

    composer -V
    # Expected output: Composer version 1.4.1
    

If you prefer to keep the installer script flow but must use a specific hash, you cannot simply reuse the default SHA384 hash from the documentation; that hash is tied to the current latest release. Using an incorrect hash will cause the else block in the verification command to execute, deleting the downloaded file immediately. Therefore, fetching via the query parameter or using a direct curl link to the GitHub releases page (e.g., https://github.com/composer/composer/releases/download/1.4.1/composer.phar) is the reliable path forward.

In production environments where system-wide installation isn't feasible due to permission restrictions, it is often safer to install Composer globally within a specific directory structure or symlink it from a project root. This avoids conflicts between different PHP versions on the same server that might require distinct Composer major versions. For instance, a Laravel application built with newer syntax might need Composer 2.x, while a legacy module requiring v1.4.1 should remain isolated to prevent autoload resolution errors.

While older versions of Composer offer compatibility with outdated packages, they lack support for modern protocols like the file:// protocol introduced in later versions and may not handle PSR-4 autoloading nuances correctly when mixed with newer dependencies. Always weigh the necessity of pinning an old version against the security implications; Composer 1.4.1 was released years ago and does not include recent vulnerability patches available in the latest stable releases. If possible, update your dependency requirements in composer.json to allow a specific minor version range rather than hardcoding the major version, ensuring you get security updates while maintaining backward compatibility where strictly necessary.

Our network