xeoncross/micromvc

Class Locale missing?

Closed this issue · 10 comments

I'm probably missing something obvious here but I can't find the required Locale class?

The locale class is actually two core functions (wrappers for the PHP ICU library) and the PHP gettext extension.

_() gettext 
__() MessageFormatter
__date() DateFormatter wrapper

Together, those provide localization and support for ICU choices or locale aware dates.

I'm getting similar problems as @filip-avocado, after installing MicroMVC for the first time I'm seeing the following in my error logs:

[Tue Nov 29 15:16:06 2011] [error] [client 127.0.0.1] PHP Warning:  require(/home/chris/workspace/Miscellaneous/micromvc/Class/Locale.php): failed to open stream: No such file or directory in /home/chris/workspace/Miscellaneous/micromvc/Common.php on line 98
[Tue Nov 29 15:16:06 2011] [error] [client 127.0.0.1] PHP Fatal error:  require(): Failed opening required '/home/chris/workspace/Miscellaneous/micromvc/Class/Locale.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/chris/workspace/Miscellaneous/micromvc/Common.php on line 98

You need PHP's intl extension. You can install it via pecl or your distribution's packages. This should make the Locale class available so it doesn't try to hit micromvc's autoloader.

Example (pecl):

sudo pecl install intl

Example (Fedora / RHEL / CentOS):

sudo yum install php-intl

Example (Debian/Ubuntu):

sudo apt-get install php5-intl

Thanks @EvanDotPro, that fixed it.

i use the wamp and enable php_intl, but this problem also exist;

Warning: require(H:\Wamp\www/Class/Locale.php) [function.require]: failed to open stream: No such file or directory in H:\Wamp\www\Common.php on line 98

@togeak you should check with the WAMP developers. However, I'm sure that it's probably not loading right. Make sure you have the right build version, and make sure it's being loaded correctly. You can create a file and <?php phpinfo(); in it to see what is loaded and what version of PHP you are using.

Wamp 2.2 / PHP 5.3.8

c:\Program Files\PHP is not in the %PATH%, thanks!

Figured I'd add this here in case anybody needs the knowledge later.

If you're trying to get this running locally on OS X 10.7.4 (using the installed Apache and PHP, not Mamp), it's not difficult.

At first I tried a standard sudo pecl install intl, but it couldn't find the ICU libraries (because they didn't exist). So I needed to install ICU

Just go to http://site.icu-project.org/download and download the latest release (49.1.1 as of writing this). Then install from source like so:

cd path/to/icu/sources
cd source
chmod +x runConfigureICU configure install-sh
./runConfigureICU MacOSX
gnumake
sudo gnumake install

And you're done. Run sudo pecl install intl and it should work just fine. Use the default location for the ICU libraries (mine didn't say where the default location was, just that it was the default).

Hint for Windows/Xampp users (like me): copy all the icu* files from /xampp/php/ folder to /xampp/apache/bin/
and add the line extension=php_intl.dll to your php.ini

[Original hint from apachefriends.org forum ]