I installed php5-intl on my osx lion.
It seems to work properly on command line mode because if I try to run the following script (1):
$fmt = datefmt_create( "en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL,'America/Los_Angeles',IntlDateFormatter::GREGORIAN );
echo "First Formatted output is ".datefmt_format( $fmt , 0)."\n";
> php -m |grep intl
intl
> php test.php
First Formatted output is Wednesday, December 31, 1969 4:00:00 PM Pacific Standard Time
But if I try to sun the same from my apache (after sudo apachectl restart
) I get the following error:
> tail /private/var/log/apache2/error_log
PHP Fatal error: Call to undefined function datefmt_create() in
PS:
I also added the following line to my php.ini
extension_dir = "/opt/local/lib/php/extensions/no-debug-non-zts-20090626"
ll /opt/local/lib/php/extensions/no-debug-non-zts-20090626
total 848
-rwxr-xr-x 1 root 261712 7 May 10:54 xdebug.so
-rwxr-xr-x 1 root 168912 31 May 19:53 intl.so
in php.ini is written: Loaded Configuration File
/private/etc/php.ini
which is the file I edited.
Other info on my configuration are the following:
/private/etc/apache2/httpd.conf
LoadModule php5_module libexec/apache2/libphp5.so
/usr/libexec/apache2/libphp5.so
/private/etc/php.ini
extension_dir = "/opt/local/lib/php/extensions/no-debug-non-zts-20090626"
Create a web page, with these contents:
<?php
phpinfo();
echo datefmt_create("en_US" ,IntlDateFormatter::FULL,IntlDateFormatter::FULL);
?>
(Yes, I know that 2nd line gives an error, but in this case it is enough to tell us it works.)
View that web page, and search for "Internationalization support" or "intl". In my case I see:
Internationalization support enabled
version 1.0.3
ICU version 4.2.1
Directive Local Value Master Value
intl.default_locale no value no value
intl.error_level 0 0
If you have no intl section present, then it can only be a php.ini issue (the more usual cause is not restarting apache, but you said you'd done that).
To confirm, edit the php.ini file again and at the very end introduce a change you can be sure will work. Eg asp_tags = 1
. Now reload your phpinfo() page and make sure you see the change there.
If you don't perhaps it is permissions; the user Apache runs as cannot read your php.ini file?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.