Resolving Composer Error: PHP Extension ext-intl Missing - System Configuration Analysis

Nov 21, 2025 · Programming · 10 views · 7.8

Keywords: Composer | PHP extension | ext-intl | command-line configuration | php.ini

Abstract: This technical article provides an in-depth analysis of the PHP extension ext-intl missing error encountered when using Composer in Windows environments. It explains the configuration differences between command-line and web PHP environments, detailing why phpinfo() shows the extension as enabled while Composer still reports errors. The article offers comprehensive troubleshooting steps and solutions, including command-line PHP configuration checks, php.ini modifications, extension loading verification, and discusses the applicability and limitations of the --ignore-platform-reqs option.

Problem Background and Phenomenon Analysis

When using Composer for dependency management, developers frequently encounter extension missing errors. Specifically, running the composer install command triggers the The requested PHP extension ext-intl * is missing from your system error. This situation is particularly common in WAMP environments on Windows platforms, even when phpinfo() confirms the extension is properly loaded.

Core Issue: Configuration Differences Between Command-line and Web Environments

The root cause lies in PHP's configuration isolation across different runtime environments. Web servers (like Apache) and command-line interfaces use different php.ini configuration files. While phpinfo() accessed via browser shows the intl extension as enabled, this only represents the web environment configuration. The command-line environment might be loading another php.ini file where the intl extension is not enabled.

Verification method: Execute the php -m command in the terminal to view the list of loaded extensions. If intl is not in the list, the problem source is confirmed. Further using the php -i command reveals the ini file path loaded by the command-line environment, typically displayed at the top of the output as Loaded Configuration File information.

Solution: Enabling intl Extension for Command-line Environment

For different PHP versions, modify the corresponding php.ini file:

For PHP 5.x versions:

; Locate the following line and remove semicolon comment
extension=php_intl.dll

For PHP 7.x and above versions:

; Locate the following line and remove semicolon comment
extension=intl

After modification, restart the terminal and run php -m again to confirm the intl extension is properly loaded. The composer install command should now complete dependency installation normally.

Alternative Approaches and Considerations

In urgent situations, the --ignore-platform-reqs option can bypass platform requirement checks:

composer install --ignore-platform-reqs

However, this method carries significant risks: if project code actually depends on intl extension functionality, runtime fatal errors will occur. Therefore, this should only serve as a temporary solution, with proper extension configuration being the fundamental approach.

Deep Understanding of Extension Loading Mechanism

PHP extension loading involves multiple layers: configuration file parsing, dependency library linking, and runtime initialization. The intl extension depends on ICU (International Components for Unicode) libraries, requiring relevant icu*.dll files to be located in the PATH environment variable or PHP executable directory in Windows environments.

Configuration verification steps:

  1. Confirm extension_dir setting in php.ini is correct
  2. Check if extension file (php_intl.dll) exists
  3. Verify dependent ICU library files are accessible
  4. Test extension loading separately in command-line and web environments

Best Practices and Preventive Measures

To avoid similar issues, recommended practices include:

Through systematic configuration management, extension loading issues caused by environmental differences can be effectively prevented, ensuring smooth development workflows.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.