PHP-Intl on XAMPP 7.4.11 / Mac Catalina 10.15.7

≯℡__Kan透↙ 提交于 2021-02-11 14:58:18

问题


I've recently updated to XAMPP 7.4.11, running on Mac Catalina 10.15.7. PHP-Intl does not come installed with XAMPP. Previously, I've been able to download the corresponding PHP version and intialize the Intl code – not this time.

When I attempt to 'make' intl, I receive the following error:

/bin/sh /Users/SLaptop/Downloads/php-7.4.11/ext/intl/libtool --mode=compile cc -I@@BITROCK_COMMON_ROOTDIR@@/include  -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/Users/SLaptop/Downloads/php-7.4.11/ext/intl -DPHP_ATOM_INC -I/Users/SLaptop/Downloads/php-7.4.11/ext/intl/include -I/Users/SLaptop/Downloads/php-7.4.11/ext/intl/main -I/Users/SLaptop/Downloads/php-7.4.11/ext/intl -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib -I/include  -DHAVE_CONFIG_H  -g -O2   -c /Users/SLaptop/Downloads/php-7.4.11/ext/intl/collator/collator_sort.c -o collator/collator_sort.lo
 cc -I@@BITROCK_COMMON_ROOTDIR@@/include -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1 -DU_HIDE_OBSOLETE_UTF_OLD_H=1 -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/Users/SLaptop/Downloads/php-7.4.11/ext/intl -DPHP_ATOM_INC -I/Users/SLaptop/Downloads/php-7.4.11/ext/intl/include -I/Users/SLaptop/Downloads/php-7.4.11/ext/intl/main -I/Users/SLaptop/Downloads/php-7.4.11/ext/intl -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib -I/include -DHAVE_CONFIG_H -g -O2 -c /Users/SLaptop/Downloads/php-7.4.11/ext/intl/collator/collator_sort.c  -fno-common -DPIC -o collator/.libs/collator_sort.o
/Users/SLaptop/Downloads/php-7.4.11/ext/intl/collator/collator_sort.c:349:26: error:
      use of undeclared identifier 'TRUE'
        collator_sort_internal( TRUE, INTERNAL_FUNCTION_PARAM_PASSTHRU );
                                ^
/Users/SLaptop/Downloads/php-7.4.11/ext/intl/collator/collator_sort.c:543:26: error:
      use of undeclared identifier 'FALSE'
        collator_sort_internal( FALSE, INTERNAL_FUNCTION_PARAM_PASSTHRU );
                                ^
2 errors generated.
make: *** [collator/collator_sort.lo] Error 1

I see several users have experienced issues with PHP-Intl in the past. There doesn't appear to be a consistent remedy, though. Does anyone have any suggestions for this beginner?


回答1:


Ok, I was able to come up with a solution. It wasn't pretty, though.

PHP-Int has separated out ICU utilities, making the extension difficult to add to XAMPP’s installed version of PHP.

I was able to do it this time by using Macports, in Mac's CLI:

sudo port install php74-intl

then, go to

/opt/local/lib/php/extensions/no-debug-non-zts-20090626/intl.so [php folder may have a number, like php74]

copy the intl.so file into

/Applications/xampp/xamppfiles/lib/php/extensions/no-debug-non-zts-20190902/ [date will vary]

Change the PHP.ini file to include the intl.so file.

And it worked ... this time, anyway!



来源:https://stackoverflow.com/questions/64540544/php-intl-on-xampp-7-4-11-mac-catalina-10-15-7

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!