search
HomeBackend DevelopmentPHP Problemphp intl extension installation

PHP intl extension installation

PHP intl is an official extension for internationalization and localization processing, including character encoding conversion, date and time formatting, currency formatting, text sorting, and language resource processing, etc. . This extension is essential when working with multilingual websites or applications.

This article will introduce how to install and enable the PHP intl extension, and provide installation steps for multiple operating systems (Windows, Mac and Linux) for readers' reference.

Installation prerequisites

Before installing the PHP intl extension, make sure your PHP version meets the following requirements:

  • PHP 5.3.0 or higher (PHP 7 Recommended)
  • ICU library 4.0 or higher

Install the ICU library

In most cases, the ICU library is already installed on the server by default. However, you can use the following command to check whether the ICU library has been installed:

icu-config --version

If the following error message is returned:

-bash: icu-config: command not found

Then you also need to install the ICU library. Here's how to install the ICU library on each operating system:

Installing the ICU library on Mac

On Mac, you can install the ICU library through Homebrew. Open the terminal and enter the following command:

brew install icu4c

After the installation is completed, you can check the version number through the following command:

icu-config --version

Install ICU library on Linux

Install ICU on Linux Libraries require the use of a package manager. For example, on Ubuntu, you can use the following command to install:

sudo apt-get install libicu-dev

On CentOS or RedHat, you can use the following command to install:

sudo yum install libicu-devel

Install the ICU library on Windows

In On Windows, you can download the ICU-for-Windows installation program from the ICU official website https://ssl.icu-project.org/download/. Please be careful to select the correct version (x86 or x64) when installing.

Install PHP intl extension

After installing the ICU library, next we need to install the PHP intl extension. The following is how to install it on each operating system:

Installing the PHP intl extension on Mac

To install the PHP intl extension on Mac you need to use the following command:

brew install php-intl

Installation completed After that, you need to restart the Apache or Nginx server:

sudo apachectl restart

or

sudo nginx -s reload

Installing the PHP intl extension on Linux

To install the PHP intl extension on Linux, you need to use the following command:

sudo apt-get install php-intl

or

sudo yum install php-intl

After installation, you need to restart the Apache or Nginx server:

sudo service httpd restart

or

sudo service nginx reload

Install PHP intl extension on Windows

To install the PHP intl extension on Windows, you need to edit the PHP php.ini file and add the following statement in the [PHP] section:

extension=php_intl.dll

After saving, you need to restart the Apache or Nginx server.

Test

After the installation is completed, you can test whether the PHP intl extension is successful by using the following code:

$fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL );
$num = $fmt->parse( '1.234.567,89' );
echo $num;

If the normal output 1234567.89 means the extension is installed successfully .

Conclusion

The installation process for the PHP intl extension is relatively simple, but slightly different in different operating systems. This article describes the steps to install the PHP intl extension on Windows, Mac and Linux. I hope it will be helpful to readers.

The above is the detailed content of php intl extension installation. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software