【问题标题】:macOS php71 became php@7.1 with brewmacOS php71 用 brew 变成 php@7.1
【发布时间】:2018-03-30 19:02:48
【问题描述】:

一天前,我用 brew 安装了普通的 php71,命令为 brew install php71

我试图安装像brew install php71-gmp 这样的 gmp 扩展,但它没有用,所以我使用谷歌搜索中的某种代码,让我的 php71 变成 php@7.1,现在没有任何扩展(比如 redis/php71- redis) 不工作。

现在尝试安装 php71 但它仍然安装 php@7.1.. 找到 homebrew/php/php71 并尝试安装但随后收到此消息:

Warning: Use php@7.1 instead of deprecated homebrew/php/php71 
Warning: php@7.1 7.1.15 is already installed`

尝试一切以使用 redis mcryt imagic gmp 等运行 php71..

酿造配置:

HOMEBREW_VERSION: 1.5.13
ORIGIN: https://github.com/Homebrew/brew
HEAD: 0f4e22e28d3b65a6c8dbb0f270bb6d262a2429d6
Last commit: 2 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: a59f6d2736fdd1acb3c71380e1e46b861146b609
Core tap last commit: 65 minutes ago
HOMEBREW_PREFIX: /usr/local
CPU: quad-core 64-bit broadwell
Homebrew Ruby: 2.3.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 9.0 build 900
Git: 2.14.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Java: 1.8.0_162
macOS: 10.13.3-x86_64
Xcode: 9.3
CLT: 9.2.0.0.1.1510905681
X11: N/A

酿造医生转储

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: Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
  /Users/pauliuslukosiunas/.composer/vendor/squizlabs/php_codesniffer/scripts/

Warning: Some keg-only formulae are linked into the Cellar.
Linking a keg-only formula, such as gettext, into the cellar with
`brew link <formula>` will cause other formulae to detect them during
the `./configure` step. This may cause problems when compiling those
other formulae.

Binaries provided by keg-only formulae may override system binaries
with other strange results.

You may wish to `brew unlink` these brews:
  php@7.1

php -v 转储

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-apcu/apcu.so' - dlopen(/usr/local/opt/php71-apcu/apcu.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-apcu/apcu.so' - dlopen(/usr/local/opt/php71-apcu/apcu.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-gmp/gmp.so' - dlopen(/usr/local/opt/php71-gmp/gmp.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-gmp/gmp.so' - dlopen(/usr/local/opt/php71-gmp/gmp.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-igbinary/igbinary.so' - dlopen(/usr/local/opt/php71-igbinary/igbinary.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-igbinary/igbinary.so' - dlopen(/usr/local/opt/php71-igbinary/igbinary.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-imagick/imagick.so' - dlopen(/usr/local/opt/php71-imagick/imagick.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-imagick/imagick.so' - dlopen(/usr/local/opt/php71-imagick/imagick.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-intl/intl.so' - dlopen(/usr/local/opt/php71-intl/intl.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-intl/intl.so' - dlopen(/usr/local/opt/php71-intl/intl.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-mcrypt/mcrypt.so' - dlopen(/usr/local/opt/php71-mcrypt/mcrypt.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-mcrypt/mcrypt.so' - dlopen(/usr/local/opt/php71-mcrypt/mcrypt.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-pdo-pgsql/pdo_pgsql.so' - dlopen(/usr/local/opt/php71-pdo-pgsql/pdo_pgsql.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-pdo-pgsql/pdo_pgsql.so' - dlopen(/usr/local/opt/php71-pdo-pgsql/pdo_pgsql.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-redis/redis.so' - dlopen(/usr/local/opt/php71-redis/redis.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-redis/redis.so' - dlopen(/usr/local/opt/php71-redis/redis.so, 9): image not found in Unknown on line 0
PHP 7.1.15 (cli) (built: Mar 29 2018 09:21:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.15, Copyright (c) 1999-2018, by Zend Technologies

**php -i |grep gmp转储**

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-apcu/apcu.so' - dlopen(/usr/local/opt/php71-apcu/apcu.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-gmp/gmp.so' - dlopen(/usr/local/opt/php71-gmp/gmp.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-imagick/imagick.so' - dlopen(/usr/local/opt/php71-imagick/imagick.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-intl/intl.so' - dlopen(/usr/local/opt/php71-intl/intl.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-mcrypt/mcrypt.so' - dlopen(/usr/local/opt/php71-mcrypt/mcrypt.so, 9): image not found in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-pdo-pgsql/pdo_pgsql.so' - dlopen(/usr/local/opt/php71-pdo-pgsql/pdo_pgsql.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-gmp/gmp.so' - dlopen(/usr/local/opt/php71-gmp/gmp.so, 9): image not found in Unknown on line 0
Configure Command =>  './configure'  '--prefix=/usr/local/Cellar/php@7.1/7.1.15' '--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/7.1' '--with-config-file-path=/usr/local/etc/php/7.1' '--with-config-file-scan-dir=/usr/local/etc/php/7.1/conf.d' '--enable-bcmath' '--enable-calendar' '--enable-dba' '--enable-dtrace' '--enable-exif' '--enable-ftp' '--enable-fpm' '--enable-intl' '--enable-mbregex' '--enable-mbstring' '--enable-mysqlnd' '--enable-opcache-file' '--enable-pcntl' '--enable-phpdbg' '--enable-phpdbg-webhelper' '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--enable-zip' '--with-apxs2=/usr/local/opt/httpd/bin/apxs' '--with-bz2' '--with-fpm-user=_www' '--with-fpm-group=_www' '--with-freetype-dir=/usr/local/opt/freetype' '--with-gd' '--with-gettext=/usr/local/opt/gettext' '--with-gmp=/usr/local/opt/gmp' '--with-icu-dir=/usr/local/opt/icu4c' '--with-jpeg-dir=/usr/local/opt/jpeg' '--with-kerberos' '--with-layout=GNU' '--with-ldap' '--with-ldap-sasl' '--with-libedit' '--with-libzip' '--with-mcrypt=/usr/local/opt/mcrypt' '--with-mhash' '--with-mysql-sock=/tmp/mysql.sock' '--with-mysqli=mysqlnd' '--with-ndbm' '--with-openssl=/usr/local/opt/openssl' '--with-pdo-dblib=/usr/local/opt/freetds' '--with-pdo-mysql=mysqlnd' '--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc' '--with-pdo-pgsql=/usr/local/opt/libpq' '--with-pgsql=/usr/local/opt/libpq' '--with-pic' '--with-png-dir=/usr/local/opt/libpng' '--with-pspell=/usr/local/opt/aspell' '--with-unixODBC=/usr/local/opt/unixodbc' '--with-webp-dir=/usr/local/opt/webp' '--with-xmlrpc' '--with-xsl' '--with-zlib' '--with-curl'
/usr/local/etc/php/7.1/conf.d/ext-gmp.ini,
gmp
gmp support => enabled

附:我是mac的新手

【问题讨论】:

  • 你能发布brew doctor的结果吗?另外,php -v 的输出是什么。
  • 添加到我的问题中 :) @Sarcastron
  • 上面写着gmp support =&gt; enabled,所以看起来GMP是用PHP核心安装的。您可以备份然后删除/usr/local/etc/php/7.1/conf.d中的符号链接
  • 我可以备份什么以及如何备份? :O 我正在寻找如何将 macbook 的所有数据恢复 1 天(现在需要 2 天)但没有找到:/

标签: macos homebrew


【解决方案1】:

我遇到了类似的问题,但扩展名不同。

问题似乎源于我运行升级后删除了旧链接。就我而言,这导致使用 PHP 的库存版本。您可以使用 CLI 命令进行检查:which php

which php
# If you see this it's the stock version
/usr/bin/php

#If you see this you are using the Homebrew version
/usr/local/bin/php

为了修复它,我使用 Homebrew 重新安装并重新链接了 php:

# Reinstall PHP 7.1
brew reinstall php@7.1

# check carefully that overwriting links won't break things
brew link --overwrite --force --dry-run php@7.1

# Run it for real this time assuming you checked
brew link --overwrite --force php@7.1

# Double check that you are now using homebrew's PHP
which php

# This should identify any missing extensions
php -v

# Reinstall missing extensions. In my case:
brew reinstall php71-xdebug php71-imagick

# Check that php can find the extension.
php -v

这对我有用。希望对你有所帮助。

【讨论】:

  • 我看到 /usr/local/opt/php@7.1/bin/php 并重新安装 php71-gmp 得到 Error: No available formula with the name "php71-gmp"
  • 昨天好像 GMP 已添加到 7.1.15 的核心中。 (braumeister.org/repos/Homebrew/homebrew-php/formula/php71-gmp)。 php -i |grep gmp 的结果是什么?
  • 在我的问题中添加了转储.. :) 我真的不明白添加到核心是什么意思?因为我读到 php71 添加到核心.. 并发现像 php 公式.. 但安装 php72 版本.. 不是 71 也无法安装 gmp 扩展,并且从来没有 php-v 因为它而工作.. 或 pdo....跨度>
  • 这意味着您不需要安装 GMP,因为它现在与 PHP 7.1 一起打包(无论如何都与 Homebrew 一起安装)。你可能已经拥有它了。但看起来您的 php 可执行文件没有正确链接。
  • brew link --overwrite --force --dry-run php@7.1的输出是什么
【解决方案2】:

由于php71homebrew/php 移动到homebrew/core(3 月 31 日左右),它被称为php@7.1

巧妙的是,大多数 php 扩展程序都已经安装了php@7.1。所以我检查了gmp 扩展名也在默认包中。因此无需手动安装(甚至无法安装),因为它已经包含php@7.1 公式。

拉取请求: https://github.com/Homebrew/homebrew-php/pull/4798

【讨论】:

  • php-redis 没有安装。试图重新安装它,但它不再存在。怎么安装?
  • 你可以用PECL安装它。但请确保使用与 brew php 捆绑在一起的 pecl。
  • 我现在想安装 imagick,但这很痛苦,因为使用“pecl install imagick”安装它希望将文件放在受保护的 /usr/include/php/ext/imagick 中Mac 操作系统
  • @wouter 你在安装php@7.1 时使用brew 提供的pecl 吗?我认为您正在尝试使用 MacOS 附带的 php 的pecl。为了确保运行which pecl,它应该看起来像这样/usr/local/opt/php@7.1/bin/pecl
  • 要使用 pecl 安装任何 php 扩展,您需要先链接您的 php 包。它应该将它们链接到 /usr/local/bin 您还需要确保在您的 PATH 中 /usr/local/bin 位于 /usr/bin 之前运行 env 以检查这一点。 brew install php@7.1 brew link --force --overwrite php@7.1 which pecl 响应应该是 "/usr/local/bin/pecl" pecl install mongodb (或任何你想安装的扩展) 要验证它已安装,你可以使用:php -i | grep -i mongo
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-29
  • 2017-09-10
  • 2017-05-30
  • 1970-01-01
  • 2018-09-18
  • 1970-01-01
相关资源
最近更新 更多