自从我的带有 php@7.4 的新 MacBook OS X Big Sur 给 XAMPP 带来问题以来,我越来越疯狂了。
据我所知,使用 OS X 中的 php 比使用 XAMPP 更好,但是在尝试使用 brew 安装 intl 时出现错误。这是我的代码:
sudo pecl install intl
当我运行上述程序时,我收到此警告:
PHP Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20190902/intl (dlopen(/usr/local/lib/php/pecl/20190902/intl, 9): image not found), /usr/local/lib/php/pecl/20190902/intl.so (dlopen(/usr/local/lib/php/pecl/20190902/intl.so, 9): image not found)) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20190902/intl (dlopen(/usr/local/lib/php/pecl/20190902/intl, 9): image not found), /usr/local/lib/php/pecl/20190902/intl.so (dlopen(/usr/local/lib/php/pecl/20190902/intl.so, 9): image not found)) in Unknown on line 0
downloading intl-3.0.0.tgz ..
然后我被问到 ICU 的路径。
Specify where ICU libraries and headers can be found [DEFAULT] :
我按 ENTER 得到这个:
running: /private/tmp/pear/temp/intl/configure --with-php-config=/usr/local/opt/php@7.4/bin/php-config --with-icu-dir=DEFAULT
然后安装开始,但最后我得到这个错误:
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: `/private/tmp/pear/temp/intl/configure --with-php-config=/usr/local/opt/php@7.4/bin/php-config --with-icu-dir=DEFAULT' failed
如果我做:
which php
我明白了:
/usr/local/opt/php@7.4/bin/php
谁能给出真正的解决方案?
谢谢!