How to Solve Error Message require ext-intl * -> it is missing from your system upon Installing and Creating Web-based Application using Code Igniter 4

Posted on

Introduction

This article has the focus on how to solve an error message upon installing and creating an new web-based application using Code Igniter 4 framework. The execution of the command exist in a virtual server. The virtual server is using CentOS 8. Moreover, the virtual server is running with the help of VirtualBox application. The error exist in the following execution for installing and creating it :

[root@localhost codeigniter]# composer create-project codeigniter4/appstarter app --no-dev
Creating a "codeigniter4/appstarter" project at "./app"
Installing codeigniter4/appstarter (v4.1.1)
  - Installing codeigniter4/appstarter (v4.1.1): Extracting archive
Created project in /var/www/html/codeigniter/app
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - codeigniter4/framework[4.0.0, ..., v4.1.1] require ext-intl * -> it is missing from your system. Install or enable PHP's intl extension.
    - Root composer.json requires codeigniter4/framework ^4 -> satisfiable by codeigniter4/framework[4.0.0, ..., v4.1.1].

To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php.ini
    - /etc/php.d/10-opcache.ini
    - /etc/php.d/20-bz2.ini
    - /etc/php.d/20-calendar.ini
    - /etc/php.d/20-ctype.ini
    - /etc/php.d/20-curl.ini
    - /etc/php.d/20-dom.ini
    - /etc/php.d/20-exif.ini
    - /etc/php.d/20-fileinfo.ini
    - /etc/php.d/20-ftp.ini
    - /etc/php.d/20-gd.ini
    - /etc/php.d/20-gettext.ini
    - /etc/php.d/20-iconv.ini
    - /etc/php.d/20-json.ini
    - /etc/php.d/20-mbstring.ini
    - /etc/php.d/20-mysqlnd.ini
    - /etc/php.d/20-pdo.ini
    - /etc/php.d/20-phar.ini
    - /etc/php.d/20-simplexml.ini
    - /etc/php.d/20-sockets.ini
    - /etc/php.d/20-sodium.ini
    - /etc/php.d/20-sqlite3.ini
    - /etc/php.d/20-tokenizer.ini
    - /etc/php.d/20-xml.ini
    - /etc/php.d/20-xmlwriter.ini
    - /etc/php.d/20-xsl.ini
    - /etc/php.d/30-mysqli.ini
    - /etc/php.d/30-pdo_mysql.ini
    - /etc/php.d/30-pdo_sqlite.ini
    - /etc/php.d/30-xmlreader.ini
    - /etc/php.d/40-zip.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.
[root@localhost codeigniter]# 

As in the output of the command execution, the process finally ends. Although, it ends actually it display an important information. It exist in the end of the output command. So, although the process above is running thoroughly, executing it to run and listen for incoming request to access the application ends in failure as follows :

[root@localhost app]# php spark serve
PHP Warning:  require(/var/www/html/codeigniter/app/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php): failed to open stream: No such file or directory in /var/www/html/codeigniter/app/spark on line 53
PHP Fatal error:  require(): Failed opening required '/var/www/html/codeigniter/app/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/codeigniter/app/spark on line 53
[root@localhost app]#

As in the above output, the solution for solving the problem is already clear. The solution is available in one line from the above output execution as follows :

- codeigniter4/framework[4.0.0, ..., v4.1.1] require ext-intl * -> it is missing from your system. Install or enable PHP's intl extension.

Solution to solve the error message

This part will execute on how to solve the error message. In order to solve the error message, just install the PHP intl extension. The following is the step for installing PHP intl extension :

1. First of all, search the package with the name of ‘php-intl’ :

[root@localhost egov]# dnf search php-intl
Last metadata expiration check: 0:59:22 ago on Tue 23 Mar 2021 10:50:40 PM EDT.
====================================================================== Name Exactly Matched: php-intl ======================================================================
php-intl.x86_64 : Internationalization extension for PHP applications
========================================================================== Name Matched: php-intl ==========================================================================
php56-php-intl.x86_64 : Internationalization extension for PHP applications
php70-php-intl.x86_64 : Internationalization extension for PHP applications
php71-php-intl.x86_64 : Internationalization extension for PHP applications
php72-php-intl.x86_64 : Internationalization extension for PHP applications
php73-php-intl.x86_64 : Internationalization extension for PHP applications
php74-php-intl.x86_64 : Internationalization extension for PHP applications
php80-php-intl.x86_64 : Internationalization extension for PHP applications
[root@localhost egov]# php -v
PHP 7.4.16 (cli) (built: Mar  2 2021 10:35:17) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies
[root@localhost app]#

2. Next, since there is a package with the name of ‘php-intl’, just install it. Execute the following command to install the package :

 
[root@localhost app]# dnf install php-intl
Last metadata expiration check: 0:59:42 ago on Tue 23 Mar 2021 10:50:40 PM EDT.
Dependencies resolved.
============================================================================================================================================================================
 Package                               Architecture                        Version                                          Repository                                 Size
============================================================================================================================================================================
Installing:
 php-intl                              x86_64                              7.4.16-1.el8.remi                                remi-modular                              242 k
Installing dependencies:
 libicu65                              x86_64                              65.1-1.el8.remi                                  remi-safe                                 9.3 M

Transaction Summary
============================================================================================================================================================================
Install  2 Packages

Total download size: 9.5 M
Installed size: 33 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): php-intl-7.4.16-1.el8.remi.x86_64.rpm                                                                                                 77 kB/s | 242 kB     00:03
(2/2): libicu65-65.1-1.el8.remi.x86_64.rpm                                                                                                  161 kB/s | 9.3 MB     00:58
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                       160 kB/s | 9.5 MB     01:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                    1/1
  Installing       : libicu65-65.1-1.el8.remi.x86_64                                                                                                                    1/2
  Installing       : php-intl-7.4.16-1.el8.remi.x86_64                                                                                                                  2/2
  Running scriptlet: php-intl-7.4.16-1.el8.remi.x86_64                                                                                                                  2/2
  Verifying        : php-intl-7.4.16-1.el8.remi.x86_64                                                                                                                  1/2
  Verifying        : libicu65-65.1-1.el8.remi.x86_64                                                                                                                    2/2

Installed:
  libicu65-65.1-1.el8.remi.x86_64                                                     php-intl-7.4.16-1.el8.remi.x86_64

Complete!
[root@localhost app]#

3. Finally, after installing the ‘php-int’ package, just execute the command again for installing and creating a new web-based application using Code Igniter 4 as follows :

[root@localhost codeigniter]# composer create-project codeigniter4/appstarter app --no-dev
Creating a "codeigniter4/appstarter" project at "./app"
Installing codeigniter4/appstarter (v4.1.1)
  - Installing codeigniter4/appstarter (v4.1.1): Extracting archive
Created project in /var/www/html/codeigniter/app
Loading composer repositories with package information
Updating dependencies
Lock file operations: 41 installs, 0 updates, 0 removals
  - Locking codeigniter4/framework (v4.1.1)
  - Locking doctrine/instantiator (1.4.0)
  - Locking fakerphp/faker (v1.13.0)
  - Locking kint-php/kint (3.3)
  - Locking laminas/laminas-escaper (2.7.0)
  - Locking laminas/laminas-zendframework-bridge (1.2.0)
  - Locking mikey179/vfsstream (v1.6.8)
  - Locking myclabs/deep-copy (1.10.2)
  - Locking nikic/php-parser (v4.10.4)
  - Locking phar-io/manifest (2.0.1)
  - Locking phar-io/version (3.1.0)
  - Locking phpdocumentor/reflection-common (2.2.0)
  - Locking phpdocumentor/reflection-docblock (5.2.2)
  - Locking phpdocumentor/type-resolver (1.4.0)
  - Locking phpspec/prophecy (1.13.0)
  - Locking phpunit/php-code-coverage (9.2.5)
  - Locking phpunit/php-file-iterator (3.0.5)
  - Locking phpunit/php-invoker (3.1.1)
  - Locking phpunit/php-text-template (2.0.4)
  - Locking phpunit/php-timer (5.0.3)
  - Locking phpunit/phpunit (9.5.4)
  - Locking psr/log (1.1.3)
  - Locking sebastian/cli-parser (1.0.1)
  - Locking sebastian/code-unit (1.0.8)
  - Locking sebastian/code-unit-reverse-lookup (2.0.3)
  - Locking sebastian/comparator (4.0.6)
  - Locking sebastian/complexity (2.0.2)
  - Locking sebastian/diff (4.0.4)
  - Locking sebastian/environment (5.1.3)
  - Locking sebastian/exporter (4.0.3)
  - Locking sebastian/global-state (5.0.2)
  - Locking sebastian/lines-of-code (1.0.3)
  - Locking sebastian/object-enumerator (4.0.4)
  - Locking sebastian/object-reflector (2.0.4)
  - Locking sebastian/recursion-context (4.0.4)
  - Locking sebastian/resource-operations (3.0.3)
  - Locking sebastian/type (2.3.1)
  - Locking sebastian/version (3.0.2)
  - Locking symfony/polyfill-ctype (v1.22.1)
  - Locking theseer/tokenizer (1.2.0)
  - Locking webmozart/assert (1.10.0)
Writing lock file
Installing dependencies from lock file
Package operations: 5 installs, 0 updates, 0 removals
  - Downloading laminas/laminas-zendframework-bridge (1.2.0)
  - Downloading laminas/laminas-escaper (2.7.0)
  - Downloading kint-php/kint (3.3)
  - Downloading codeigniter4/framework (v4.1.1)
  - Installing psr/log (1.1.3): Extracting archive
  - Installing laminas/laminas-zendframework-bridge (1.2.0): Extracting archive
  - Installing laminas/laminas-escaper (2.7.0): Extracting archive
  - Installing kint-php/kint (3.3): Extracting archive
  - Installing codeigniter4/framework (v4.1.1): Extracting archive
11 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
[root@localhost codeigniter]#

4. Last but not least, execute the following command to start the service for listening incoming request to the web-based application using Code Igniter 4 framework as follows :

[root@10 app]# php spark serve

CodeIgniter v4.1.1 Command Line Tool - Server Time: 2021-03-23 22:59:35 UTC-05:00

CodeIgniter development server started on http://localhost:8080
Press Control-C to stop.

As in the above output, it is exist that the process is a success. Moreover, the service using Code Igniter 4 web-based application is also running.

Leave a Reply