How to Install PHP Intl module on OneClick OpenliteSpeed WordPress Web server?

WebHow to Install PHP Intl module on OneClick OpenliteSpeed WordPress Web server?

The PHP intl module is an extension to the PHP language, which provides internationalization and localization support in your applications. This is an essential framework to translate messages in your application which provides multi-language support for PHP applications, allowing developers to create websites and applications that can be easily translated into different languages. The module contains a variety of functions for dealing with text, dates, and numbers, including collation, normalization, and string parsing. In this blog, we’ll discuss what the PHP Intl module is, how to install it on a OneClick OpenLiteSpeed WordPress web server, and common errors that occur due to a missing PHP Intl module in an OpenLiteSpeed WordPress installation. You might have noticed this error on the WordPress Site Health page.

PHP Intl module-related error in WordPress Site Health Screen Page
PHP Intl module-related error in WordPress Site Health Screen Page

PHP intl module is a very powerful tool in most web applications that offer numerous functions including but not limited to the following:

  1. Text collation: The PHP Intl module provides functions for sorting text in different languages, allowing you to sort text in a way that makes sense in the language it’s being displayed in.
  2. Text normalization: The PHP Intl module provides functions for normalizing text, which helps to ensure that text is displayed correctly in different languages, even in languages with different writing systems.
  3. String parsing: The PHP Intl module provides functions for parsing strings, making it easier to extract information from text in different languages.
  4. Date and time formatting: The PHP Intl module provides functions for formatting dates and times in different languages, allowing you to display dates and times in a way that makes sense in the language it’s being displayed in.
  5. Number formatting: The PHP Intl module provides functions for formatting numbers in different languages, allowing you to display numbers in a way that makes sense in the language it’s being displayed in.
  6. Message translation: The PHP Intl module provides functions for translating messages, allowing you to provide multi-language support for your website or application.
  7. Sorting arrays of text in different languages: The PHP Intl module provides functions for sorting arrays of text in a way that makes sense in the language it’s being displayed in.
  8. Converting text between different scripts: The PHP Intl module provides functions for converting text between different scripts, allowing you to display text in different writing systems correctly.

You may also like to read: How to Automatically Restart MariaDB on Failure in Bitnami?

The intl module consists of two parts:

  1. A set of functions for parsing and formatting dates, times, numbers, currency values and other sorts of data according to a variety of locale-specific conventions.
  2. A framework for creating, loading and caching locale data based on RFC3066 (unicode) standard.

Common Errors Due to Missing PHP Intl module in OpenLiteSpeed WordPress Installation:

If the PHP Intl module is missing from an OpenLiteSpeed WordPress installation, a number of errors can occur. Some of the most common errors include:

  1. The “Illegal string offset” error when sorting arrays: This error occurs when attempting to sort an array using the sort() function. The PHP Intl module provides a number of functions for sorting text in different languages, so if the module is missing, sorting text in languages other than English can result in this error.
  2. The “Fatal error: Call to undefined function collator_create()” error: This error occurs when attempting to use the collator_create() function, which is part of the PHP Intl module. The function is used to create collators for sorting text in different languages, so if the module is missing, this function will not be available and this error will occur.
  3. The “Notice: Use of undefined constant INTL_ICU_VERSION” error: This error occurs when attempting to use the constant INTL_ICU_VERSION, which is part of the PHP Intl module. The constant is used to determine the version of the ICU library that is installed on the server, so if the PHP Intl module is missing, this constant will not be defined and this error will occur.
  4. “Fatal error: Uncaught Error: Class ‘IntlDateFormatter’ not found”
  5. “Fatal error: Uncaught Error: Class ‘IntlCalendar’ not found”
  6. “Fatal error: Uncaught Error: Class ‘IntlTimeZone’ not found”
  7. “Fatal error: Uncaught Error: Class ‘IntlGregorianCalendar’ not found”
  8. “Fatal error: Uncaught Error: Class ‘Collator’ not found”
  9. “Fatal error: Uncaught Error: Class ‘MessageFormatter’ not found”
  10. “Fatal error: Uncaught Error: Class ‘NumberFormatter’ not found”
  11. “Fatal error: Uncaught Error: Class ‘Normalizer’ not found”
  12. “Fatal error: Uncaught Error: Call to undefined function intl_get_error_code()”
  13. “Fatal error: Uncaught Error: Call to undefined function intl_get_error_message()”

How to Install PHP Intl module on OneClick OpenliteSpeed WordPress Web server?

Installing the PHP Intl module on a OneClick OpenLiteSpeed WordPress web server is a relatively simple process. Here are the steps to follow:

  1. Log in to your server via SSH
  2. Run the following command to install the PHP Intl module: $ sudo yum install php-intl
  3. Restart the OpenLiteSpeed server for the changes to take effect: sudo service lsws restart

 For Ubuntu Linux, first Add the LiteSpeed Debian Repository then install the intl module for your PHP version. 

$ sudo apt-get update
$ wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash
$ sudo apt-get install lsphp81-intl  // In case of centOS or Yum installer -> $ sudo yum install lsphp81-intl

$ killall -9 lsphp
$ systemctl restart lsws

In the above command, we are installing the intl module for PHP version 8.1, in the case of PHP 8.0 use the command $ sudo apt-get install lsphp80-intl

If you are using WordPress then try refreshing the Site Health page now and the error will disappear. Do not forget to clear the cache plugin.

You can verify the installation by creating a phpinfo.php file in your web root directory (with the following code content) and accessing it in your browser:

<?php
phpinfo();
?>

When the page is loaded, search for intl and make sure that it’s enabled.

Showing PHP intl Module enabled on a OpenLiteSpeed Web Server
Showing PHP intl Module enabled on a OpenLiteSpeed Web Server

Note: The above steps are for the OpenLiteSpeed web server installed on Ubuntu 20.04 and later. The package name and the steps may vary for different distributions and versions.

Conclusion:

The PHP Intl module is an essential tool for developers creating multi-language websites and applications. With its wide range of internationalization functions, it provides a standardized way to deal with text, numbers, and dates in different languages. Installing the PHP Intl module on a OneClick OpenLiteSpeed WordPress web server is a simple process, and can help to avoid a number of common errors. If you’re building a multi-language website or application, consider using the PHP Intl module to ensure that your application is properly internationalized.

Neil S
Neil S
Neil is a highly qualified Technical Writer with an M.Sc(IT) degree and an impressive range of IT and Support certifications including MCSE, CCNA, ACA(Adobe Certified Associates), and PG Dip (IT). With over 10 years of hands-on experience as an IT support engineer across Windows, Mac, iOS, and Linux Server platforms, Neil possesses the expertise to create comprehensive and user-friendly documentation that simplifies complex technical concepts for a wide audience.
Watch & Subscribe Our YouTube Channel
YouTube Subscribe Button

Latest From Hawkdive

You May like these Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.