codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.39k stars 1.9k forks source link

Bug: Missing function locale_set_default(...) #3171

Closed John-Betong closed 4 years ago

John-Betong commented 4 years ago

Download: git clone https://github.com/codeigniter4/CodeIgniter4.git

File: ./system/CodeIgniter/CodeIgniter.php

Output:

Fatal error: Uncaught Error: Call to undefined function CodeIgniter\locale_set_default() in /var/www/CodeIgniter4/system/CodeIgniter.php:184 Stack trace:

0 /var/www/CodeIgniter4/system/bootstrap.php(181): CodeIgniter\CodeIgniter->initialize()

1 /var/www/CodeIgniter4/public/index.php(36): require('/var/www/CodeIg...')

2 {main}

thrown in /var/www/CodeIgniter4/system/CodeIgniter.php on line 184

Fix: /**

michalsn commented 4 years ago

Please install intl extension - this is a required component.

keehui commented 4 years ago

Hi there, I installed intl extension but still receiving this error.

cijagani commented 4 years ago

intl extension required for php cli also.

cijagani commented 4 years ago

can you verify it?

keehui commented 4 years ago
php --info | grep intl
Configure Command =>  './configure'  '--prefix=/usr/local/Cellar/php@7.3/7.3.22' '--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/7.3' '--with-config-file-path=/usr/local/etc/php/7.3' '--with-config-file-scan-dir=/usr/local/etc/php/7.3/conf.d' '--with-pear=/usr/local/Cellar/php@7.3/7.3.22/share/php@7.3/pear' '--enable-bcmath' '--enable-calendar' '--enable-dba' '--enable-dtrace' '--enable-exif' '--enable-ftp' '--enable-fpm' '--enable-intl' '--enable-mbregex' '--enable-mbstring' '--enable-mysqlnd' '--enable-opcache-file' '--enable-pcntl' '--enable-phpdbg' '--enable-phpdbg-readline' '--enable-phpdbg-webhelper' '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--enable-zip' '--with-apxs2=/usr/local/opt/httpd/bin/apxs' '--with-bz2=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr' '--with-curl=/usr/local/opt/curl-openssl' '--with-fpm-user=_www' '--with-fpm-group=_www' '--with-freetype-dir=/usr/local/opt/freetype' '--with-gd' '--with-gettext=/usr/local/opt/gettext' '--with-gmp=/usr/local/opt/gmp' '--with-iconv=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr' '--with-icu-dir=/usr/local/opt/icu4c' '--with-jpeg-dir=/usr/local/opt/jpeg' '--with-kerberos=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr' '--with-layout=GNU' '--with-ldap=/usr/local/opt/openldap' '--with-ldap-sasl=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr' '--with-libxml-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr' '--with-libedit=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr' '--with-libzip' '--with-mhash=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr' '--with-mysql-sock=/tmp/mysql.sock' '--with-mysqli=mysqlnd' '--with-ndbm=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr' '--with-openssl=/usr/local/opt/openssl@1.1' '--with-password-argon2=/usr/local/opt/argon2' '--with-pdo-dblib=/usr/local/opt/freetds' '--with-pdo-mysql=mysqlnd' '--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc' '--with-pdo-pgsql=/usr/local/opt/libpq' '--with-pdo-sqlite=/usr/local/opt/sqlite' '--with-pgsql=/usr/local/opt/libpq' '--with-pic' '--with-png-dir=/usr/local/opt/libpng' '--with-pspell=/usr/local/opt/aspell' '--with-sodium=/usr/local/opt/libsodium' '--with-sqlite3=/usr/local/opt/sqlite' '--with-tidy=/usr/local/opt/tidy-html5' '--with-unixODBC=/usr/local/opt/unixodbc' '--with-webp-dir=/usr/local/opt/webp' '--with-xmlrpc' '--with-xsl=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr' '--with-zlib=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr'
intl
intl.default_locale => no value => no value
intl.error_level => 0 => 0
intl.use_exceptions => 0 => 0

It show this when i check intl extension

briancalma commented 4 years ago

I am using ubuntu 20.04 you shall install php7.4-intl by running the following command: sudo apt install php7.4-intl

adonisnr commented 4 years ago

Please install intl extension - this is a required component.

I had this issue using XAMPP on Windows 10.

himanshupatel1902 commented 4 years ago

Issue resolved in Ubuntu

edit php.ini file located at /etc/php/7.4/apache2/php.ini

remove ; before "extension=intl"

means ;extension=intl

should become

extension=intl

DanielTheGeek commented 4 years ago

image

Above is what I now get after enabling intl in PHP.ini

paulbalandan commented 4 years ago

image

Above is what I now get after enabling intl in PHP.ini

Please change CI_ENVIRONMENT to development in your .env file.

DanielTheGeek commented 4 years ago

image Above is what I now get after enabling intl in PHP.ini

Please change CI_ENVIRONMENT to development in your .env file.

That worked fine but another thing that worked too was setting up a virtual host configuration for my local domain and adding it into the hosts file. Now everything works fine at mydomain.local. Thank you very much!

Ansulsingkang commented 3 years ago

try to change in /system/Codeignater.php line 184 locale_set_default($this->config->defaultLocale ?? 'en');

become:

if( function_exists('locale_set_default' ) ) :
    locale_set_default($this->config->defaultLocale ?? 'en');
    endif;
shayenakhan commented 3 years ago

try to change in /system/Codeignater.php line 184 locale_set_default($this->config->defaultLocale ?? 'en');

become:

if( function_exists('locale_set_default' ) ) :
    locale_set_default($this->config->defaultLocale ?? 'en');
    endif;

thanks... solved my issue

Ansulsingkang commented 3 years ago

You're welcome, i'm happy hear it

ferneyvanegas commented 3 years ago

try to change in /system/Codeignater.php line 184 locale_set_default($this->config->defaultLocale ?? 'en');

become:

if( function_exists('locale_set_default' ) ) :
    locale_set_default($this->config->defaultLocale ?? 'en');
    endif;

Funcionó! Thanx man!

Imanur commented 3 years ago

Permisi mau tanya dong, kalau mengalami eror seperti ini bagaimana solusinya ya?

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required 'C:\xampp\htdocs\ci4\vendor\codeigniter4\framework\system\Commands\Server/rewrite.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0

Mohon bantuanya semua, terima kasih

maslakonetop commented 3 years ago

try to change in /system/Codeignater.php line 184 locale_set_default($this->config->defaultLocale ?? 'en');

become:

if( function_exists('locale_set_default' ) ) :
    locale_set_default($this->config->defaultLocale ?? 'en');
    endif;

Hi Thanks alot. It solved my issued, when I deploy on my hosting.

maslakonetop commented 3 years ago

Permisi mau tanya dong, kalau mengalami eror seperti ini bagaimana solusinya ya?

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required 'C:\xampp\htdocs\ci4\vendor\codeigniter4\framework\system\Commands\Server/rewrite.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0

Mohon bantuanya semua, terima kasih

Lihat deh jawaban https://github.com/codeigniter4/CodeIgniter4/issues/3171#issuecomment-737053932 Aku berhasil solved pake itu.

siilmyy commented 2 years ago

Permisi mau tanya dong, kalau mengalami eror seperti ini bagaimana solusinya ya? Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required 'C:\xampp\htdocs\ci4\vendor\codeigniter4\framework\system\Commands\Server/rewrite.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0 Mohon bantuanya semua, terima kasih

Lihat deh jawaban #3171 (comment) Aku berhasil solved pake itu.

tapi di aku kok ga ada folder system? dimana ya itu file codeiniter 4?

kenjis commented 2 years ago

Check phpinfo() if you have intlextension installed. If not install it. Screenshot 2022-08-01 16 57 41

On CLI you can check with php -m:

$ php -m | grep intl
intl

All you need to do is to install intlextension. Because it is a necessary extension. To skip locale_set_default() code create another problem.

siilmyy commented 2 years ago

Thank u so much, it works on my project!

On Mon, Aug 1, 2022, 3:05 PM kenjis @.***> wrote:

Check phpinfo() if you have intlextension installed. If not install it. [image: Screenshot 2022-08-01 16 57 41] https://user-images.githubusercontent.com/87955/182101184-97d6cadb-b787-453c-b812-931fc6c0c69e.png

On CLI you can check with php -m:

$ php -m | grep intl intl

All you need to do is to install intlextension. Because it is a necessary extension. To skip locale_set_default() code create another problem.

— Reply to this email directly, view it on GitHub https://github.com/codeigniter4/CodeIgniter4/issues/3171#issuecomment-1200858456, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARJZYV35C5JBH6ZRVMFVPCLVW6AOHANCNFSM4OJAI2CA . You are receiving this because you commented.Message ID: @.***>