Php intl extension windows

Installation

—enable-intl will enable the
extension while compiling PHP.

If your ICU is installed to a non-standard directory then you might want to
specify its location in
LD_LIBRARY_PATH
environment variable so that dynamic linker can find it:

$ export LD_LIBRARY_PATH=/opt/icu/lib

Otherwise, if PHP and ICU are installed to their default locations, then the
additional options to configure are not needed.

Found A Problem?

Saurabh

2 years ago

For amazon nginx server (CentOs), try the following:

sudo yum install libicu-devel
sudo yum install php-intl

daniel at danielphenry dot com

10 years ago

To install on windows uncommenting the dll in php.ini is not enough you also need to include several other libraries in your system path (not user path). Found these details here: http://stackoverflow.com/a/6086991/819883

jltupac at hotmail dot com

11 years ago

Ubuntu:
sudo apt-get install php5-intl

Anonymous

2 years ago

ArchLinux:

pacman -S icu php-intl

lee dot wp14 at gmail dot com

4 years ago

For ubuntu: apt install php-intl

Нужно установить php-intl т.к. проект без него не запускается. Выводи ошибки… Подскажите как это сделать? Заранее спасибо.


  • Вопрос задан

  • 12487 просмотров

Она уже должна быть установлена начиная с версии PHP5.3
В php.ini раскоментируй
extension=php_intl.dll
Не забудь перезапустить сервер

https://stackoverflow.com/questions/1451468/intl-e…

Перевод:
Все дистрибутивы на странице содержат файл `php_intl.dll`, расположенный в поддиректории `ext/`. Всё что от вас требуется — это проверить в конфиге PHP, где хранятся библиотеки (extension_dir) и добавить / раскоментировать строку:
extension=php_intl.dll

Пригласить эксперта

в OpenServer
1. Остановить OpenServer
2. Зайти в меню -> Дополнительно -> Конфиграция -> PHP
3. Откроется файл конфигурации
4. Найти строку «extension=php_intl.dll»
5. Убрать «;» в начале строки -> Сохранить
6. Запустить сервер
Ошибка должна исчезнуть


  • Показать ещё
    Загружается…

Минуточку внимания

PHP is one of the most widely-used server-side scripting languages for web development. It powers millions of websites worldwide due to its simplicity and flexibility. However, when developing multilingual websites or applications that need to support different regions and languages, developers face several challenges. One way to overcome these challenges is by using the PHP intl (internationalization) extension. This extension provides a comprehensive set of tools for working with various language formats, making it easier to build globalized applications.

In this article, we will provide a detailed guide on how to install PHP intl extension on various Linux distributions, including Ubuntu, CentOS, and other variants. By the end of this guide, you will have the intl extension installed and ready to use.

What is PHP Intl?

The PHP intl extension is part of the Internationalization (Intl) extension suite, built on top of the ICU (International Components for Unicode) library. It enables developers to perform operations that depend on language and region settings. This includes, but is not limited to:

  • Locale-aware number formatting: Formats numbers based on the locale.
  • Date and time formatting: Presents dates and times in a manner specific to a region.
  • Message formatting: Constructs messages dynamically using placeholders.
  • Text transformation: Converts text between different formats and scripts, including transliteration (e.g., Cyrillic to Latin).
  • Unicode collation: Allows comparison and sorting of strings based on Unicode standards.

The intl extension simplifies the development of applications intended for international use, ensuring consistency in how information is presented to users around the globe.

Why is PHP Intl Extension Important?

Building an application that can support multiple languages involves more than just translating text. Developers need to account for cultural differences in how information is presented, which is where the intl extension becomes invaluable. Here are key reasons why the PHP intl extension is important:

  1. Locale-aware operations: The extension ensures that numeric values, currencies, dates, and times are displayed in a way that conforms to the user’s regional standards.
  2. Accurate string collation: Sorting and comparing strings can be tricky when different languages have unique rules. The intl extension handles this gracefully by following Unicode collation rules.
  3. Dynamic message formatting: Instead of hardcoding text, developers can create templates with placeholders that adjust according to the context and language.
  4. Transliteration support: It enables converting text from one script to another, a common requirement when dealing with user-generated content in different languages.

Without the intl extension, developers would have to write custom solutions for these tasks, which could lead to inconsistencies and increased maintenance overhead.

Prerequisites

Before we proceed with the installation steps, make sure you meet the following prerequisites:

  • A Linux server with root or sudo privileges
  • An active PHP installation (the instructions vary slightly depending on your PHP version)
  • Access to a terminal for executing commands

How to Install PHP Intl Extension on Ubuntu

Ubuntu is a popular choice for web servers, and installing the PHP intl extension on it is straightforward. Follow these steps:

Step 1: Update the package list

Updating your package list ensures you have access to the latest versions of packages.

sudo apt update

Step 2: Install the intl extension

For PHP 7.x:

sudo apt install php-intl

For PHP 8.x:

sudo apt install php8.0-intl   # Replace 8.0 with your specific PHP version

Step 3: Restart the web server

After the installation, restart your web server to ensure the changes take effect:

sudo systemctl restart apache2  # For Apache
sudo systemctl restart php8.0-fpm  # For Nginx with PHP-FPM

Step 4: Verify the installation

To confirm that the intl extension has been installed correctly, create a phpinfo() file or run the following command:

php -m | grep intl

If the extension is listed, it means the installation was successful.

How to Install PHP Intl Extension on CentOS

CentOS, another commonly used server OS, requires a slightly different approach. Here’s how to install the PHP intl extension on CentOS:

Step 1: Enable EPEL and Remi repositories (if necessary)

If you haven’t enabled these repositories yet, run:

sudo yum install epel-release
sudo yum install yum-utils
sudo yum-config-manager --enable remi-php74   # Replace 74 with your PHP version

Step 2: Install the intl extension

Once the repositories are enabled, install the intl extension using:

sudo yum install php-intl

Step 3: Restart the web server

Restart your web server to apply the changes:

sudo systemctl restart httpd  # For Apache
sudo systemctl restart php-fpm  # For Nginx with PHP-FPM

Step 4: Verify the installation

Run the following command to check if the intl extension is loaded:

php -m | grep intl

If you see intl in the output, the installation was successful.

How to Install PHP Intl Extension on Other Linux Variants

For other Linux distributions, the process is generally similar, but some specifics may vary depending on the package manager. Here is a general guide:

Step 1: Install necessary dependencies

Ensure that the ICU (International Components for Unicode) library and development tools are installed. For example, on Debian-based systems:

sudo apt install libicu-dev

On Red Hat-based systems:

sudo yum install libicu-devel

Step 2: Install the intl extension

Use the appropriate package manager for your distribution. For instance:

  • Debian-based systems:sudo apt install php-intl
  • Red Hat-based systems:sudo yum install php-intl

Step 3: Restart the web server

After installing the extension, restart your web server:

sudo systemctl restart apache2  # For Apache
sudo systemctl restart php-fpm  # For Nginx with PHP-FPM

Step 4: Verify the installation

Run the following command to confirm that the intl extension is active:

php -m | grep intl

If the output lists intl, you have successfully installed the extension.

You may also like:

  • How to Install PHP JSON Extension on Ubuntu / CentOS: 7 Easy Step
  • How to Install PHP 8.4 on RHEL 9: Easy Steps
  • How to Install PHP 8.4 on RHEL 9: Easy Steps
  • How to Install PHP Extensions for WordPress: 3 Easy Steps

Learn PHP

  • PHP for Beginners
  • PHP for Beginners – Become a PHP Master – CMS Project
  • Become a WordPress Developer: Unlocking Power With Code

Conclusion

The PHP intl extension is a powerful tool for building internationalized web applications. It simplifies the complexities of dealing with different languages, regional settings, and scripts. By following the detailed steps in this guide, you can easily install the intl extension on various Linux distributions, including Ubuntu, CentOS, and other variants.

Ensuring that this extension is properly installed allows your application to present information in a way that aligns with the user’s cultural expectations, improving usability and accessibility. Whether you are building an e-commerce platform or a content management system, having robust internationalization support is a must.

We hope this comprehensive guide on how to install PHP intl extension has been helpful. If you encounter any issues during the installation process, consider checking the official PHP documentation, your server’s logs, or reaching out to online communities for further assistance.

FAQs: How to Install PHP intl Extension

What is the PHP intl extension used for?

The PHP intl extension provides tools for internationalization, including locale-aware formatting of dates, numbers, and currencies, as well as Unicode string collation and transliteration.

Do I need to install any dependencies before installing the PHP intl extension?

Yes, you may need to install the ICU (International Components for Unicode) library, which is a dependency of the intl extension. The specific package name varies by distribution.

How can I check if the PHP intl extension is installed?

You can verify the installation by running the following command:

php -m | grep intl

Alternatively, create a phpinfo() file and look for the intl section in the output.

Why is the intl extension not showing up after installation?

If the intl extension is not listed after installation, try restarting your web server (Apache or Nginx) and ensure that the correct PHP version is being used. You may also need to check the php.ini file to confirm that the extension is enabled.

Can I install the PHP intl extension on a Windows system?

Yes, on Windows, you can enable the intl extension by uncommenting the following line in the php.ini file:

extension=intl

After making the change, restart your web server.

Is there a difference between installing the intl extension for PHP 7 and PHP 8?

The installation process is largely the same, but you need to ensure that you are installing the version of the intl extension that matches your PHP version. For example, use php7.4-intl for PHP 7.4 and php8.0-intl for PHP 8.0.

What should I do if I encounter errors during installation?

If you encounter errors, check your server logs for detailed error messages. Ensure that your package manager is up to date, and verify that the necessary repositories (like EPEL or Remi for CentOS) are enabled.

Is it possible to compile the intl extension manually?

Yes, if pre-built packages are not available for your distribution, you can compile the intl extension manually from the PHP source. Ensure that the ICU development libraries are installed before compiling.

How do I uninstall the PHP intl extension?

To uninstall the intl extension, use the package manager for your distribution. For example:

  • On Ubuntu/Debian:sudo apt remove php-intl
  • On CentOS/Red Hat:sudo yum remove php-intl

After uninstallation, restart your web server.

Can I use the PHP intl extension with Nginx?

Yes, the PHP intl extension works with both Apache and Nginx. Just ensure that the PHP-FPM service is restarted after installation.

The Internationalization extension (Intl) is a wrapper for the ICU library, a set of C/C++ and Java libraries that provide Unicode and Globalization support for software applications. It enables PHP programmers to perform UCA-conformant collation and date/time/number/currency formatting in their scripts.

The Intl extension is required in Moodle 3.4 onwards.

MS Windows

To enable this extension add the following line to your php.ini file usually found in /php:


extension= php_intl.dll

And then set the intl.default_locale and intl.error_level directives in your php.ini file.


[intl]

intl.default_locale = en_utf8

intl.error_level = E_WARNING

The intl.error_level directive is optional.

In a WAMP installation it may be required to add the php path to the system PATH so that the module4 could uploaded properly (see http://forum.wampserver.com/read.php?2,80704,82499 for a couple of other approaches).

Problems in Windows 11 VirtualBox virtual machines

If you had the msvcp110.dll missing file error, you added that file and then you got the intl missing error which can not be solved by doing the above instructions, you need to go to http://www.microsoft.com/es-es/download/confirmation.aspx?id=30679 and install the vcredist_x64.exe and vcredist_x86.exe, as described in https://stackoverflow.com/a/18876880

Other operating systems

Use system package manager or specify compilation flag.

  • Debian 5.0 (& Ubuntu) use: apt-get install php-intl.
  • CentOS 8.0 (& Red Hat) use: dnf install php-intl. CentOS 7.0 (& RedHat) use: yum install php-intl. The package name may be slightly different depending on the repository used for PHP packages, e.g. php74-intl.

See also

  • INTL Introduction
  • PHP Internationalization Functions
  • Table of locales lists the locales that you can use.

Problem

PHP packages/frameworks/libraries/scripts we work with might require different PHP extensions. In this case the Intl extension is needed to work with using Internationalization Functions.

What is Internationalization?

Got any of these error messages?

  • Zend InputFilter requires intl PHP extension
  • The requested PHP extension intl is missing from your system

This happened because the PHP Intl extension isn’t installed or enabled.

Parts of this tutorial can be also a guide for installing or enabling other extensions.

What is PHP Intl?

Internationalization extension (further is referred as Intl) is a wrapper for » ICU library, enabling PHP programmers to perform various locale-aware operations including but not limited to formatting, transliteration, encoding conversion, calendar operations

Source: PHP Documentation

This extension may be installed using the bundled version as of PHP 5.3.0, or as a PECL extension as of PHP 5.2.0. In other words, there are two methods to install the intl extension.

Source: PHP Documentation

Cause

If you have installed the unbundled PHP version, the extension is not installed on the system. (unless you’ve installed it separately)

If you have the bundled PHP version, the extension might be existing but not enabled.

Solutions

For Linux-based Server (assuming you have root access):

  • Make sure the php_intl.so file exists within your php extensions directory, find the extensions directory by:
    • using phpinfo()
    • running this command: php -r "echo ini_get('extension_dir');"
    • (note: both options gets the extension_dir right from the PHP runtime configuration)
  • If the file exists:
    • search for the config file (php.ini, usually /etc/php.ini) and open it
    • Make sure the line “extension=php_intl.so” is existing and not commented
    • Restart the web server (usually sudo service httpd restart)
    • Check if the extension is enabled using phpinfo()
  • If the file doesn’t exist
    • Check your php version by running the “php -v” command
    • For PHP 5 install the php-intl package using your package manager – package managers and commands
      • Most common: apt-get install php-intl (for ubuntu-based linux) or yum install php-intl (for CentOS)
    • For PHP 7, install the php7.x-intl (depending on your php version)
    • Repeat the steps for the case in which the file exists

For projects hosted on a shared hosting platform you must ask your hosting provider to install/enable the PHP Intl extension.

For Windows-based Server:

  • Make sure the php_intl.dll file exists within your php extensions directory
    • for separately installed PHP: C:\path\to\php\ext\
    • for xampp: C:\path\to\xampp\php\ext
    • (note: your drive letter might be different)
  • If the file exists:
    • search for the config file (php.ini, usually in the same folder as the php executable) and open it
    • Make sure the line “extension=php_intl.dll” is existing and not commented
    • Restart the web server (usually apache)
    • Check if the extension is enabled using phpinfo()
  • If the file doesn’t exist:
    • Check your php version by running the “php -v” command
    • Download the PHP version that corresponds to yours from the PHP Downloads Page (TS/NTS, x86/x64)
      • To find thread safety for php, run: php -i | findstr “Thread” , source & more info.
    • Search for the php_intl.dll file in the ext folder in that version and copy it in your php\ext folder
    • Repeat the steps for the case in which the file exists

Edit: changed php7.0 occurrences with php7.x as the version may vary.


Looking for PHP, Laminas or Mezzio Support?

As part of the Laminas Commercial Vendor Program,
Apidemia offers expert technical support and services for:

  • Modernising Legacy Applications
  • Migration from any version of Zend Framework to Laminas
  • Migration from legacy Laminas API Tools (formerly Apigility) to Dotkernel API
  • Mezzio and Laminas Consulting and Technical Audit
  • Понравилась статья? Поделить с друзьями:
    0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии
  • Grub install from windows
  • Как удалить принтер в windows 10 полностью с драйверами
  • Теневые копии windows 10 программа
  • Java 7 для игр windows 7
  • Lenovo xclarity essentials bootable media creator for windows