Error Call to undefined function CodeIgniter

Posted on

locale_set_default() CodeIgniter

This “Error Call to undefined function CodeIgniter locale_set_default()” error occurs when I do “php spark serve”. The system I’m currently using is Linux Ubuntu with Xampp.

[Error]

Call to undefined function CodeIgniter\locale_set_default()

at SYSTEMPATH/CodeIgniter.php:181

Backtrace:
  1    SYSTEMPATH/bootstrap.php:146
       CodeIgniter\CodeIgniter()->initialize()

  2    ROOTPATH/spark:45
       require('/home/neon/Documents/KERJA/PERUSAHAAN/DIGITA SCIENTIA/PROJECT/TANAH BUMBU/dlh-tanah-bumbu-master/vendor/codeigniter4/framework/system/bootstrap.php')

In the CodeIgniter PHP framework, the function locale_set_default() sets the default system locale. This function is typically used to change the default language used by the system for date and time formatting, as well as other localization settings.

The function takes one parameter, which is the locale to be set as the default (e.g. ‘en_US’ for US English).

example : locale_set_default(‘en_US’);

This function needs to be called before any localization functions (such as date() or strftime()) are used in the script, in order to ensure that the correct settings are used.

How to fix it?

Open terminaL. Because I’m using PHP version 8.0, I have to install the intl extension. Use the following command:

sudo apt install php8.0-intl

Done, I hope this Error Call to undefined function CodeIgniter article is useful.

Read more: