🛠️ Fixing Filament Installation Error on Ubuntu: Missing intl Extension and PHP Version Mismatch

When trying to install Filament on Ubuntu using composer require filament/filament, you encounter two critical errors:

  1. Missing PHP intl extension (ext-intl not enabled in CLI).
  2. PHP version conflict (Filament v3.3.x requires PHP 8.1+ but your CLI uses PHP 8.3, while your web server may use a different version).

Step-by-Step Solution:

1. Install the PHP intl Extension
The intl extension is required by Filament but missing in your CLI environment.

sudo apt update
sudo apt install php8.2-intl  # Use PHP 8.2 (widely supported)

2. Switch Default PHP Version for CLI
Ensure CLI and web server use compatible PHP versions (e.g., PHP 8.2):

sudo update-alternatives --config php
  • Select php8.2 from the list (enter its selection number).
  • Verify with: php -v

3. Enable the intl Extension
Check if intl is enabled:

php -m | grep intl  # Should output "intl"

If missing, manually enable it:

sudo phpenmod intl  # For PHP 8.2
sudo systemctl restart apache2 # Or nginx/php-fpm

4. Reinstall Filament
Retry the installation:

composer require filament/filament

⚠️ Critical Note: Avoid –ignore-platform-req Shortcut

While Composer suggests using --ignore-platform-req=ext-intl to bypass the error:

# NOT RECOMMENDED FOR PRODUCTION
composer require filament/filament --ignore-platform-req=ext-intl

Why this is dangerous:

  1. Hidden Runtime Errors: Filament requires intl for core functionality (date/number formatting, translations).
  2. Environment Inconsistency: Your local environment won’t match production, causing “works on my machine” failures.
  3. Security Risks: Missing extensions may bypass security validations.
  4. Upgrade Traps: Future updates may fail catastrophically when dependency checks pass but actual requirements aren’t met.

Acceptable use cases:

  • Temporary testing during development (immediately fix afterward)
  • CI/CD pipelines where extensions are managed separately
  • When you’ll manually verify all intl-dependent functionality

Why the Full Solution Works:

  1. Consistent Environment
    Syncs CLI (Composer) and web server PHP versions (8.2 recommended for stability).
  2. Proper Dependency Handling
    Installs required system-level extensions instead of masking missing components.
  3. Future-Proofing
    Prevents runtime errors in Filament’s admin panel, forms, and table components that rely on intl.

Troubleshooting Tips:

  • PHP Version Check:
# CLI version:
php -v

# Web server version (create info.php):
<?php phpinfo();
  • Extension Verification:
# Check loaded extensions:
php -r "print_r(get_loaded_extensions());"
  • Fallback for PHP 8.3:
    If you must use PHP 8.3:
sudo apt install php8.3-intl # If available in your repo
sudo update-alternatives --set php /usr/bin/php8.3
  • Verify PHP.ini:
    Check /etc/php/8.2/cli/php.ini for extension=intl (should be uncommented).

Always resolve platform requirements instead of ignoring them – your production environment will thank you! 🚀

Leave a Reply