Current Location: Home> Latest Articles> Complete Guide to Installing and Configuring PHP Intl Extension on CentOS

Complete Guide to Installing and Configuring PHP Intl Extension on CentOS

gitbox 2025-08-04

The Importance of Installing PHP Intl Extension on CentOS

The PHP Intl extension is a crucial component for enabling multi-language and localization support in PHP. It relies on the International Components for Unicode (ICU) library, allowing developers to easily handle locale-aware formatting of dates, times, numbers, and strings, greatly enhancing multilingual compatibility and user experience.

Preparation for Installing PHP Intl Extension on CentOS

First, ensure your server has PHP installed. If not installed yet, you can install it using the following command:

<span class="fun">sudo yum install php</span>

Dependencies Required for PHP Intl Extension Installation

Before installing the extension, you need to install the necessary dependencies to ensure the environment supports it:

<span class="fun">sudo yum install php-intl php-pecl-intl</span>

Installing the PHP Intl Extension

After dependencies are installed, execute the following command to install the PHP Intl extension:

<span class="fun">sudo yum install php-intl</span>

Once installation is complete, restart your web server or PHP service to apply the changes. For example, restart Apache:

<span class="fun">sudo systemctl restart httpd</span>

Verifying Successful Installation of PHP Intl Extension

Create a PHP info page to check the extension status. Create a file named info.php in your web root directory with the following content:

<?php
phpinfo();
?>

Then access this page in your browser (e.g., http://your-server-ip/info.php) and search for "intl" to confirm the extension is loaded correctly.

Optional Configuration Adjustments for PHP Intl Extension

If you want to customize configurations, enable the extension in your PHP configuration file php.ini. Make sure it contains the following line:

<span class="fun">extension=intl</span>

Save the changes and restart the service to apply the new settings.

Summary

Following the steps outlined in this article, you can successfully install and configure the PHP Intl extension on CentOS, providing powerful internationalization support for your PHP applications to meet multilingual user requirements. If you encounter any issues, consult official documentation and community resources to ensure a smooth installation process.