php - php7 和 php7.1 在 OSX 中使用 homebrew
问题描述
由于自制软件的后期升级,即使库存在并且配置指向正确的路径,我也开始在终端中收到这些警告
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-apcu/apcu.so' - dlopen(/usr/local/opt/php70-apcu/apcu.so, 9): Symbol not found: _zend_signal_globals
Referenced from: /usr/local/opt/php70-apcu/apcu.so
Expected in: flat namespace
in /usr/local/opt/php70-apcu/apcu.so in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-apcu/apcu.so' - dlopen(/usr/local/opt/php70-apcu/apcu.so, 9): Symbol not found: _zend_signal_globals
Referenced from: /usr/local/opt/php70-apcu/apcu.so
Expected in: flat namespace
in /usr/local/opt/php70-apcu/apcu.so in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-intl/intl.so' - dlopen(/usr/local/opt/php70-intl/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.59.dylib
Referenced from: /usr/local/opt/php70-intl/intl.so
Reason: image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-intl/intl.so' - dlopen(/usr/local/opt/php70-intl/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.59.dylib
Referenced from: /usr/local/opt/php70-intl/intl.so
Reason: image not found in Unknown on line 0
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
Warning: Module 'mcrypt' already loaded in Unknown on line 0
Configuration File (php.ini) Path: /usr/local/etc/php/7.0
Loaded Configuration File: /usr/local/etc/php/7.0/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.0/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.0/conf.d/ext-apcu.ini,
/usr/local/etc/php/7.0/conf.d/ext-igbinary.ini,
/usr/local/etc/php/7.0/conf.d/ext-intl.ini,
/usr/local/etc/php/7.0/conf.d/ext-mcrypt.ini,
/usr/local/etc/php/7.0/conf.d/ext-memcached.ini,
/usr/local/etc/php/7.0/conf.d/ext-oauth.ini,
/usr/local/etc/php/7.0/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
执行哪个php时
/usr/local/opt/php@7.0/bin/php
这是 brew list 的结果
brew list ✔ 10956 12:18:48
apr libffi openssl@1.1 php@5.6
apr-util libmemcached pcre php@7.0
aspell libpng php55 php@7.1
autoconf libpq php55-intl pkg-config
automake libtool php55-mcrypt pv
composer libxml2 php56 python
dnsmasq libyaml php56-intl python@2
freetds libzip php56-mcrypt readline
freetype m4 php56-pcntl ruby
gdbm makedepend php70 sqlite
gettext mcrypt php70-apcu tmux
glib memcached php70-igbinary tree
gmp mhash php70-intl unixodbc
gnu-sed n98-magerun php70-mcrypt webp
heroku ncdu php70-memcached xz
icu4c nginx php70-oauth zsh
jpeg node php70-opcache zsh-syntax-highlighting
jq oniguruma php70-xdebug
libevent openssl php71
这是 brew doctor 的输出
brew doctor ✔ 10981 12:38:48
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: A newer Command Line Tools release is available.
Update them from Software Update in the App Store.
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5m-config
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5-config
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3-config
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/node/ares.h
/usr/local/include/node/ares_build.h
/usr/local/include/node/ares_rules.h
/usr/local/include/node/ares_version.h
/usr/local/include/node/nameser.h
/usr/local/include/node/openssl/archs/BSD-x86/opensslconf.h
/usr/local/include/node/openssl/archs/BSD-x86_64/opensslconf.h
/usr/local/include/node/openssl/archs/VC-WIN32/opensslconf.h
/usr/local/include/node/openssl/archs/VC-WIN64A/opensslconf.h
/usr/local/include/node/openssl/archs/aix-gcc/opensslconf.h
/usr/local/include/node/openssl/archs/aix64-gcc/opensslconf.h
/usr/local/include/node/openssl/archs/darwin-i386-cc/opensslconf.h
/usr/local/include/node/openssl/archs/darwin64-x86_64-cc/opensslconf.h
/usr/local/include/node/openssl/archs/linux-aarch64/opensslconf.h
/usr/local/include/node/openssl/archs/linux-armv4/opensslconf.h
/usr/local/include/node/openssl/archs/linux-elf/opensslconf.h
/usr/local/include/node/openssl/archs/linux-ppc/opensslconf.h
/usr/local/include/node/openssl/archs/linux-ppc64/opensslconf.h
/usr/local/include/node/openssl/archs/linux-x32/opensslconf.h
/usr/local/include/node/openssl/archs/linux-x86_64/opensslconf.h
/usr/local/include/node/openssl/archs/linux32-s390x/opensslconf.h
/usr/local/include/node/openssl/archs/linux64-s390x/opensslconf.h
/usr/local/include/node/openssl/archs/solaris-x86-gcc/opensslconf.h
/usr/local/include/node/openssl/archs/solaris64-x86_64-gcc/opensslconf.h
/usr/local/include/node/openssl/des_old.h
/usr/local/include/node/openssl/dso.h
/usr/local/include/node/openssl/krb5_asn.h
/usr/local/include/node/openssl/kssl.h
/usr/local/include/node/openssl/pqueue.h
/usr/local/include/node/openssl/ssl23.h
/usr/local/include/node/openssl/ui_compat.h
/usr/local/include/node/pthread-fixes.h
/usr/local/include/node/v8-debug.h
/usr/local/include/node/v8-experimental.h
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
python@2
heroku
python
php55
Warning: Your Xcode (9.2) is outdated.
Please update to Xcode 9.4 (or delete it).
Xcode can be updated from the App Store.
Warning: Broken symlinks were found. Remove them with `brew prune`:
/usr/local/bin/docker-credential-osxkeychain.backup
/usr/local/bin/hyperkit.backup
/usr/local/bin/notary.backup
/usr/local/bin/vpnkit.backup
任何有关如何解决这些警告的帮助表示赞赏
解决方案
对于任何想解决此问题的人,您必须删除 php 和相关库并重新安装,因为 homebrew/php tap 已被弃用,所有用于安装的库都成为 homebrew/core 的一部分。
所以默认情况下你会在安装时安装 php7.2,$ brew isntall php
但你可以手动安装特定版本,如 php@7.0。如果您需要 xdebug,您可以使用 pecl install xdebug 安装并在 php.ini 中添加路径
推荐阅读
- c# - 用户在游戏中保存材料
- javascript - 无法在上传之前为图像大小验证及其不同类型格式添加警报通知我们如何实现
- sql - 任何 SQL 标准,您不必为了查看它而选择 GROUP BY 的列?
- codenameone - WebRTC 在 Codename One 和 AntMedia 使用中的当前支持状态
- mongodb - 如何获取给定地址的国家/地区代码
- sql - 我应该使用单一的复合索引吗?
- windows - 在 Windows 10 上安装 Win32::Unicode::Console 失败:t/04_print.t 测试失败
- laravel - Laravel 显示 404 页面如果缺少必需的参数错误
- filemaker - 如何编写适用于任何表的通用 Filemaker 搜索/脚本?
- r - ggplot/ggscatter 的问题