Phpredis: Unable to use homebrew to install phpredis.

Created on 23 Apr 2018  路  6Comments  路  Source: phpredis/phpredis

Homebrew-php is deprecated/deleted/dead as a dodo.
Homebrew-core is now the thing.
brew install php70-redis (or any version) is no longer present.

Whilst it isn't directly phpredis's issue what some third party package manager has done, I'm hoping someone here knows the right magic to install this extension, ideally via homebrew (but not necessary if an easier option is available).

Most helpful comment

pecl install redis results in this:

Build process completed successfully
Installing '/usr/local/Cellar/php/7.2.7/pecl/20170718/redis.so'

Warning: mkdir(): File exists in System.php on line 294

Warning: mkdir(): File exists in /usr/local/Cellar/php/7.2.7/share/php/pear/System.php on line 294
ERROR: failed to mkdir /usr/local/Cellar/php/7.2.7/pecl/20170718

Solution

Because /usr/local/Cellar/php/7.2.7/pecl is not a directory. It's a symlink to /usr/local/lib/php/pecl

The solution to that is that the pecl that's being used is in /usr/local/Cellar/php/7.2.7/bin/pecl, and not the 7.2.7/pecl file, so that symlink can be removed, and a directory created.

For those who bump into this problem.

Double check which pecl and what that file is pointing to, etc.

All 6 comments

You can always install extension via pecl
pecl install redis
or compile it from scratch :)

I realised that once I realised phpredis and pecl/redis are the same. Any reason why the names aren't consistent?

pecl install redis results in this:

Build process completed successfully
Installing '/usr/local/Cellar/php/7.2.7/pecl/20170718/redis.so'

Warning: mkdir(): File exists in System.php on line 294

Warning: mkdir(): File exists in /usr/local/Cellar/php/7.2.7/share/php/pear/System.php on line 294
ERROR: failed to mkdir /usr/local/Cellar/php/7.2.7/pecl/20170718

Solution

Because /usr/local/Cellar/php/7.2.7/pecl is not a directory. It's a symlink to /usr/local/lib/php/pecl

The solution to that is that the pecl that's being used is in /usr/local/Cellar/php/7.2.7/bin/pecl, and not the 7.2.7/pecl file, so that symlink can be removed, and a directory created.

For those who bump into this problem.

Double check which pecl and what that file is pointing to, etc.

One issue I ran into is that pecl installredisdumpedextension="redis.so"at the top of myphp.ini`. This was invalid, and gave me an error like this:

Warning: PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/local/lib/php/pecl/20170718/redis.so (dlopen(/usr/local/lib/php/pecl/20170718/redis.so, 9): image not found), /usr/local/lib/php/pecl/20170718/redis.so.so (dlopen(/usr/local/lib/php/pecl/20170718/redis.so.so, 9): image not found)) in Unknown on line 0

I removed the extension="redis.so" line and instead created /usr/local/etc/php/7.2/conf.d/ext-redis.ini with:

extension="/usr/local/Cellar/php/7.2.9_2/pecl/20170718/redis.so"

for me it went like this:
$ wget https://github.com/nicolasff/phpredis/archive/master.zip
(unzip)
$ cd
$ phpize ;./configure ;make ; sudo make install

$ find your php; for me it was /usr/local/etc/php/7.1/conf.d/
$ navigate there and:
cat >> ext-redis.ini << 'AyeCaramba'
extension="/usr/local/Cellar/[email protected]/7.1.25/pecl/20160303/redis.so"
AyeCaramba
$ brew services restart [email protected]

version in the above
extension="/usr/local/Cellar/[email protected]/7.1.25/pecl/20160303/redis.so"
may differ to make sure to double check that path.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xkenner picture xkenner  路  3Comments

marius-meissner picture marius-meissner  路  5Comments

fidelhuang picture fidelhuang  路  5Comments

RobChen picture RobChen  路  4Comments

koleo picture koleo  路  4Comments