can't create a Laravel project because mcrypt extension is missing

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company

The Ghost in the Machine: Why Missing mcrypt Stops Your Laravel Project on Legacy Systems

If you’ve encountered this specific roadblock—the inability to create a modern Laravel project because the necessary mcrypt extension is missing—you are not alone. This issue is a classic symptom of trying to bridge modern application frameworks with severely outdated PHP environments. As a senior developer, I’ve seen countless tickets related to legacy dependencies, and understanding why this happens is just as important as knowing how to fix it.

This post will walk through the technical breakdown of why this dependency conflict occurs and provide a pragmatic path forward, steering you away from complicated, unnecessary virtual machine setups.

The Root of the Problem: Legacy Dependencies vs. Modern Frameworks

The frustration you are experiencing stems from an incompatibility between the requirements of older software (like Laravel 5.x) and the security/architecture demands of modern operating systems (macOS Yosemite running PHP 5.5.14).

The mcrypt extension was a widely used, but now deprecated, library for symmetric encryption in older PHP versions. When you use composer create-project laravel/laravel, Composer attempts to install the framework and its dependencies. If that dependency chain requires an extension (ext-mcrypt) that is either missing or incompatible with your current PHP build, Composer rightfully halts the process, reporting that the required packages cannot be resolved.

Your attempts to manually compile mcrypt using Homebrew and then recompile it yourself are commendable efforts, but they expose a deeper architectural mismatch. You successfully got the file onto the system, but the specific location or compilation flags expected by PHP 5.5.14—especially when dealing with system-level libraries like those managed by Homebrew—are often mismatched. The error confirms that the runtime environment simply doesn't recognize the extension in a usable state for that specific PHP binary.

Why Manual Compilation Fails (and What to Avoid)

When you manually compile extensions, you are essentially fighting against the operating system’s established package management system (like Homebrew). Trying to force an old dependency onto a modern environment often leads to broken configurations or security vulnerabilities, which is exactly what we want to avoid when starting a new project.

For any serious development, especially with frameworks like Laravel—which emphasizes clean architecture and maintainability—we must prioritize using supported environments. Attempting to patch ancient PHP installations introduces technical debt that will plague future maintenance.

The Practical Solution: Upgrade Your Environment

The most robust, practical, and secure solution is not to fight the legacy dependencies but to upgrade your environment to a modern standard. This approach ensures compatibility, security, and access to the latest features offered by the ecosystem, aligning perfectly with the philosophy behind modern development practices promoted by platforms like laravelcompany.com.

Recommended Steps:

  1. Upgrade PHP: PHP 5.5 is End-of-Life (EOL). You need a supported version of PHP to run modern Laravel applications. Use Homebrew or a dedicated tool like Valet to install a current, stable PHP version (e.g., PHP 8.2 or 8.3).
  2. Use Docker: For complex dependency management, especially when dealing with specific legacy requirements or environment isolation, containerization is the gold standard. Using Docker allows you to spin up an exact, isolated PHP environment—regardless of your host OS—ensuring that dependencies are installed correctly every single time. This completely bypasses local system conflicts and avoids installing heavy virtualization software.

By adopting a modern toolchain, you eliminate the need to manually chase obscure extension files and resolve version wars. You move from debugging system-level configuration errors to focusing purely on building excellent code.

Conclusion

The inability to create a project due to a missing mcrypt dependency is a classic symptom of using obsolete tooling. While it feels like an unsolvable local puzzle, the true solution lies in recognizing that the environment itself is the bottleneck. Stop trying to force old dependencies onto modern tools. Upgrade your PHP installation and leverage containerization for reliable, reproducible development environments. This shift will save you countless hours of frustrating troubleshooting down the line.