Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: CodeIgniter\I18n -> Class 'Locale' not found #3294

Closed
devorama opened this issue Jul 12, 2020 · 11 comments
Closed

Bug: CodeIgniter\I18n -> Class 'Locale' not found #3294

devorama opened this issue Jul 12, 2020 · 11 comments
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@devorama
Copy link
Contributor

Describe the bug
Was looking at this issue
#1807

when I tried to test his samples, I then looked at docs on how to load the class
https://codeigniter4.github.io/CodeIgniter4/libraries/time.html?highlight=settimezone
But instead I got the error
Class 'Locale' not found

Checked the source and there is nothing named Locale file or Text wise for a class

IncomingRequest has this logic in there code, but Time.php uses it directly

                        if (class_exists('\Locale', false))
			{
				\Locale::setDefault($locale);
			} 

A clear and concise description of what the bug is.

CodeIgniter 4 version
4.0.3

Affected module(s)
Time.php , part of CodeIgniter\I18n

Expected behavior, and steps to reproduce if appropriate
Should load the file

@devorama devorama added the bug Verified issues on the current code behavior or pull requests that will fix them label Jul 12, 2020
@paulbalandan
Copy link
Member

You need to have the intl extension installed on your machine.

@devorama
Copy link
Contributor Author

@paulbalandan Thank you for that , did not realize it via the docs, might be handy to mention it in docs, if it is somewhere I missed it sorry, thanks again.

You need to have the intl extension installed on your machine.

@devorama
Copy link
Contributor Author

For extra reference thanks to paulbalandan comment I found the php manual doc entry for it
https://www.php.net/manual/en/class.locale.php
one can get the install info etc from there based on the pacakge the class in part of.
(https://www.php.net/manual/en/book.intl.php)

@paulbalandan
Copy link
Member

It's okay. It is stated in the README.

https://github.com/codeigniter4/CodeIgniter4#server-requirements

@devorama
Copy link
Contributor Author

Thank you again @paulbalandan for the quick help. Then all good I just missed it. Thanks again

@adityabayu1231
Copy link

Thanks

@huynhminhsangit
Copy link

huynhminhsangit commented Nov 8, 2022

I'm facing this problem after setting vhost, if i run serve with spark cml: php spark serve it's ok, when i try using vhost, i get locale class not found.
Note: intl extension in php.ini without semicolon.
Anyone pls send me a solution to fix this. Thank you very much!
My OS: MacOS 13.0
Model: Mac Air M1 2020
@kenjis

@kenjis
Copy link
Member

kenjis commented Nov 8, 2022

You need to have the intl extension installed in your vhost PHP.

@cijagani
Copy link
Contributor

cijagani commented Nov 8, 2022

@huynhminhsangit you need to enable extension in php.ini for php-cli. There will be 2 php.ini files. You have to do in php-cli too.

Probably Location should be like this

/etc/php/8.0/cli/php.ini
/etc/php/8.1/cli/php.ini

@huynhminhsangit
Copy link

I try view in location you suggest but not see it
image

@kenjis
Copy link
Member

kenjis commented Nov 26, 2022

You need to know where the php.ini locates. There may be many php.ini in your PC.
You can find the path with the phpinfo() function for web, or the php --ini command for CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

No branches or pull requests

6 participants