9

One day ago I had the normal php71 installed with brew with command brew install php71

I was trying to install gmp extension like brew install php71-gmp but it didn't worked so i used some kind of code from google search and made my php71 to become php@7.1 and now none of extensions (like redis/php71-redis) are not working.

now tryng to install php71 but it still installs php@7.1.. found homebrew/php/php71 and trying to install but then got this message:

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

Trying everything to get run php71 with redis mcryt imagic gmp and so on..

brew config:

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

brew doctor dump

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 dumps

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 dump **

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

P.S. I'm new on mac's

bfontaine
  • 18,169
  • 13
  • 73
  • 107
Scorpioniz
  • 1,421
  • 3
  • 16
  • 36

2 Answers2

22

I had a similar issue but with different extensions.

The problem seemed to stem from older links being removed after I ran an upgrade. In my case this caused the stock version of PHP to be used. You can check this with the CLI command: 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

To fix it I reinstalled and relinked php using Homebrew:

# 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

That is what worked for me. I hope it helps you out.

Sarcastron
  • 1,527
  • 14
  • 20
  • 1
    with which i see `/usr/local/opt/php@7.1/bin/php` and with reinstall php71-gmp getting `Error: No available formula with the name "php71-gmp"` – Scorpioniz Mar 30 '18 at 19:59
  • 1
    Looks like GMP was added to core for 7.1.15 just yesterday. (http://www.braumeister.org/repos/Homebrew/homebrew-php/formula/php71-gmp). What is the result of `php -i |grep gmp`? – Sarcastron Mar 30 '18 at 20:07
  • added dumps to my question.. :) I really dont understand what does it mean added to core? because i read that php71 added to core.. and found like php formula.. but installing php72 version.. not 71 also cant install gmp extension and never php-v is working because of it.. or pdo.... – Scorpioniz Mar 30 '18 at 20:17
  • It means that you don't need to install GMP because it is now packaged with PHP 7.1 (when installed with Homebrew anyway). You probably already have it. But it does look like your `php` executable is not properly linked. – Sarcastron Mar 30 '18 at 20:23
  • What is the output of `brew link --overwrite --force --dry-run php@7.1` – Sarcastron Mar 30 '18 at 20:24
  • `Warning: Already linked: /usr/local/Cellar/php@7.1/7.1.15 To relink: brew unlink php@7.1 && brew link php@7.1` – Scorpioniz Apr 01 '18 at 11:09
  • This works, but you need to restart your terminal session for it to take effect on that session. – Linus Juhlin Apr 24 '19 at 06:09
3

Since php71 was moved from homebrew/php to homebrew/core (around 31st of March) it has been called php@7.1.

The neat thing is, most of all the php extension are already installed with php@7.1. So I checked and the gmp extension is also in the default package. So no need to install it manually (you cannot even do it), because it is already packed with the php@7.1 formula.

The pull request: https://github.com/Homebrew/homebrew-php/pull/4798

remi
  • 311
  • 2
  • 7
  • php-redis is not installed though. Trying to re-install it, but it doesnt exist anymore. How to install it? – Wouter Apr 10 '18 at 07:19
  • You can install it with PECL. But make sure you use the pecl bundled with the brew php. – remi Apr 11 '18 at 08:05
  • Mcrypt isn't included either, and it seems there is no PECL version available for PHP 7.1. – Scott Buchanan Apr 11 '18 at 19:52
  • Mcrypt is already included in `php@7.1` But please note mcrypt is deprecated and will be removed in php7.2 from the core. But you still will be able to install it via PECL. http://php.net/manual/en/migration71.deprecated.php – remi Apr 16 '18 at 15:26
  • 2
    I want to install imagick now, but this is a great pain as installing it with "pecl install imagick" wants to put the file in /usr/include/php/ext/imagick which is protected by Mac OS – Wouter Apr 17 '18 at 10:19
  • 2
    @wouter do you use the `pecl` supplied by brew while installing `php@7.1`? I think you are trying the use the `pecl` of php shipped with MacOS. To be sure run `which pecl`, it should look like this `/usr/local/opt/php@7.1/bin/pecl` – remi Apr 18 '18 at 12:10
  • 1
    To install any php extension using pecl, you need to link your php package first. It should be linking them in /usr/local/bin You also need to make sure that in your PATH /usr/local/bin comes before /usr/bin Run `env` to check this. `brew install php@7.1` `brew link --force --overwrite php@7.1` `which pecl` Response should be "/usr/local/bin/pecl" `pecl install mongodb` (or whatever extension you want to install) To verify it installed you can use: `php -i | grep -i mongo` – Michael Pawlowsky Jul 19 '18 at 13:25
  • ```Error: No available formula with the name "php@7.1" ==> Searching for a previously deleted formula (in the last month)... Error: No previously deleted formula found. ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... ==> Searching taps on GitHub... Error: No formulae found in taps. ``` – Yuseferi Mar 12 '20 at 11:30