Install PHP 7.0 Internationalization extension (Intl) on XAMPP on Mac

匿名 (未验证) 提交于 2019-12-03 01:38:01

问题:

I followed the instructions outlined here:

Install PHP Internationalization extension (Intl) on XAMPP on Mac

Ran sudo pecl install intl selected the correct files from the Cellar

then this error happened:

/private/tmp/pear/temp/intl/intl_error.h:24:10: fatal error: 'ext/standard/php_smart_str.h' file not found

include

     ^ 1 error generated. make: *** [php_intl.lo] Error 1 ERROR: `make' failed 

No matter, did some research and found out that PHP 7.0.8 deprecated php.smart_str.h to php.smart_string.h

So given my scant knowledge of C++ I copied smart_string.h to smart_str.h and renamed all the headers from STRING to string.....

re-ran pecl -no luck....more errors......without knowing where the .c files are and remaking php (not really interested in going that far) since anyway I'm using XAMPP so that ended that option.

I have php 5.5 on my mac, deep in the usr/local/bin folder so next step was to get pecl to use those files and generate an intl.so file....

Did that....I have the intl.so file so put it in the 'extensions' folder in XAMPP (for reference: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012)

Ran php and came up with this error:

Warning: PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so, 9): Symbol not found: _zval_used_for_init Referenced from: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so Expected in: flat namespace in /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20151012/intl.so in Unknown on line 0

I imagine it has to do with different versions?

In any case I can't get pecl to install intl without a make error in PHP 7.0.8 on XAMPP. There is no documentation on this and you'd think that if you deprecate a header.h file you'd update all extensions?

Install intl.so in PHP 7 seems impossible?

回答1:

So far, it seems that extension intl.so for php is bundled with php and should be compiled with php (intl --enabled). XAMPP does not support this (as of Oct 2016), MAMP does. I do not know about other distros. However, if you're willing to recompile PHP 7, it's worth it just to do that and enable it during compiling.

So....I ran with MAMP. Then I decided that I would simply install apache 2.4 and php 7 and Mysql without the stack and the junk that comes with MAMP or XAMPP and everything works like a charm... so if you need to use CakePHP or intl support etc... just drop XAMPP/MAMP and go with a standard install. I used homebrew (MacOS) and everything is working fine.

Update: As regards Windows, XAMPP does not default it, but you can add the module (dll) in php.ini and works like a charm



回答2:

The error means that XAMPP doesn't have PHP compiled with intl. You may try:

pecl install intl 

but probably it won't work as well.

See: PHP Bug #72879 Pecl install intl make error with PHP 7.0.8.


As for the workaround, try installing memcached extension instead of memcache, e.g.

pecl install memcached 

Note: It also requires libmemcached package/library to be installed beforehand. For macOS, install via: brew install libmemcached.



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