Resolving Dependency Conflicts When Installing PHP intl on CentOS
The error you encountered is a classic example of dependency hell, specifically caused by version mismatches between packages from different repositories. Your system currently runs PHP and its core components from the REMI repository, indicated by the @remi tag in your installed php-common-5.3.17-2.el6.remi.x86_64. However, you attempted to install the php-intl package from the standard CentOS base or updates repository, which provides version 5.3.3-14.el6_3.
Linux package managers like yum operate on a strict contract: every package requires specific versions of its dependencies. The error message explicitly states that php-intl requires php-common = 5.3.3-14.el6_3, but your system has 5.3.17. Because PHP extensions are tightly coupled with the core PHP version and build flags, you cannot simply swap one version of a core component for another without potentially breaking the application logic or causing memory corruption.
Understanding the Repository Mismatch
The root cause is that you are mixing repositories. The standard CentOS repository (base) provides older versions of PHP packages (like the 5.3.3 series in your error log), while REMI provides newer, bleeding-edge builds for Enterprise Linux 6. When you ran yum install php-intl, yum resolved the request to the package available in the default repos because that was the only source it found, or perhaps the REMI repo wasn't configured to provide the specific build of php-intl that matches your REMI PHP core.
To fix this safely on a production machine, you must ensure all PHP packages come from the same source. The most direct solution is to update your PHP packages specifically from the REMI repository so their versions align. You can do this by telling yum to prioritize REMI for these specific packages:
sudo yum install --enablerepo=remi php-intl
By adding --enablerepo=remi, you force yum to look at the REMI repository for the php-intl package. Since your existing php-common is from REMI, this command should locate a matching php-intl version that satisfies the dependency constraint php-common = 5.3.17-2.el6.remi. This approach avoids breaking your application by keeping the PHP core and the extension in sync.
Analyzing the Error Suggestions
Regarding the suggestions in the error message: --skip-broken and rpm -Va, these are generally not safe for production environments without a clear understanding of the consequences.
The --skip-broken flag tells yum to ignore packages that have unresolvable dependencies during installation. While this allows the command to complete, it leaves your system in an inconsistent state where critical parts of PHP might be missing or incomplete. Running a web application with a partially installed PHP stack can lead to unpredictable behavior, as the interpreter may crash when it encounters code relying on the missing intl functions.
The suggestion rpm -Va --nofiles --nodigest is a verification command that checks the integrity of installed RPM packages against their metadata (like file lists and MD5 digests). Running this after an error won't fix the dependency issue; it will only confirm that your current installation is broken or that files are missing. It is a diagnostic tool, not a repair mechanism.
Alternative Installation Methods
If enabling the repository flag does not work, you might need to manually download the RPM for the correct version and force an installation, though this requires careful dependency management. You would typically locate the exact .rpm file that matches your PHP version (e.g., php-intl-5.3.17-2.el6.remi.x86_64) from a trusted source or mirror.
Once downloaded, you can attempt to install it with:
sudo rpm -Uvh php-intl-5.3.17-2.el6.remi.x86_64.rpm --nodeps
Using --nodeps bypasses the dependency check entirely. While this might seem risky, in this specific scenario, the dependencies are already satisfied by your existing php-common package; the issue was purely that yum couldn't find the matching intl package in its default search. However, using --nodeps is a last resort. It should only be done if you have verified via rpm -q php-intl --queryformat '%{VERSION}' that the version matches your core exactly.
Final Verification
After installing the extension, do not assume it is active immediately. You must reload the PHP configuration and restart the web server (Apache or Nginx with PHP-FPM) to pick up the new module. Then, verify installation by creating a file named info.php in your document root containing:
<?php phpinfo(); ?>
Search this output for "intl" or check the list of enabled extensions. If you are developing with Laravel or similar frameworks, ensure that your composer.json does not inadvertently conflict with native PHP extensions, though typically the C extension installed via yum is preferred over Composer-managed alternatives for core language features like internationalization.
For further guidance on managing complex PHP environments in production, resources such as https://laravelcompany.com can offer insights into best practices, but always prioritize keeping your underlying OS packages consistent to avoid stability issues.
