Search code examples
phpcodeigniter-4intl

codeigniter error with call to undefined function codeigniter\locale_set_default() search


This is the error I see in CodeIgnitor 4 on a new server installation.

Fatal error: Uncaught Error: Call to undefined function CodeIgniter\locale_set_default() 

When I look at potential problems I see that I have the intl extension installed but when I do this command:

    php -i | grep -i intl

returns

    intl.default_locale => no value => no value

Solution

  • So the solution I've found is to edit the PHP configuration files and add:

       intl.default_locale="en-US"
    

    I added it to /etc/php.d/20-intl.ini but your local configuration may vary.

    Then I tested the apache configuration and restarted:

        apachectl configtest
        apachectl restart
    

    The error didn't go away so I continued my search and found php-fpm was running:

        ps auxwww | grep -i PHP 
    

    which returned

    apache   10499  0.0  0.4 292148 16672 ?        S    17:07   0:00 php-fpm: pool www
    apache   10502  0.0  0.4 292148 16696 ?        S    17:07   0:00 php-fpm: pool www
    apache   10503  0.0  0.3 290076 13756 ?        S    17:07   0:00 php-fpm: pool www
    apache   10504  0.0  0.3 290076 13768 ?        S    17:07   0:00 php-fpm: pool www
    apache   10506  0.0  0.2 288028 11624 ?        S    17:07   0:00 php-fpm: pool www
    apache   20201  0.0  0.3 290076 13744 ?        S    17:16   0:00 php-fpm: pool www
    

    so I restarted that service with this command:

        service php-fpm restart
    

    and now everything seems to be running perfectly. There were still a few permissions issues to address with a new install of CodeIgnitor but those are for another post.