How to install php-redis extension on mac os 10.13? - macos

For a few days I'm trying to install php-redis extension.
Try use brew and getting this...
$ brew install php71-redis
Error: No available formula with the name "php71-redis"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
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.
Trying to install with PECL and getting this...
$ sudo pecl install redis
downloading redis-4.1.0.tgz ...
Starting to download redis-4.1.0.tgz (220,774 bytes)
..............................................done: 220,774 bytes
25 source files, building
running: phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
************
************
checking whether to enable igbinary serializer support... yes
checking whether to enable lzf compression... yes
checking use system liblzf... no
checking for igbinary includes... configure: error: Cannot find igbinary.h
ERROR: `/private/tmp/pear/install/redis/configure --with-php-config=/usr/bin/php-config --enable-redis-igbinary=нуы --enable-redis-lzf=yes' failed
and finally trying to install igbinary.h ....
$ sudo pecl install igbinary
downloading igbinary-2.0.7.tgz ...
Starting to download igbinary-2.0.7.tgz (73,523 bytes)
************
************
Build process completed successfully
Installing '/usr/include/php/ext/igbinary/igbinary.h'
ERROR: failed to mkdir /usr/include/php/ext/igbinary

I just did this on Mac OS 10.13 (I'm still using High Sierra).
With homebrew php7.2 and up, pecl is now installed by default alongside the php binaries.
To see this for yourself type which pecl.
Steps to install
Check your version of redis, then find a suitable version of the extension here.
If unfamiliar with pecl, type pecl to see the options.
Issue pecl install redis 5.0.2. (or your version). Enter no to each question asked if you're not sure.
If that succeeds check the new file it created at: /usr/local/lib/php/pecl/20180731/redis.so
The install will have added extension="redis.so" to top of your php ini.
Check that by opening the file /usr/local/etc/php/7.3/php.ini.
(assuming you're on 7.3 there)
brew services restart php.
php -i | grep Redis
Redis Support => enabled
Redis Version => 5.0.2
Did this in September 2019 and it works for me.

For this, try to disable the csrutil on OSx (Mac):
Reboot your Mac
When the Mac starts, typo Command + R until you get into recovery mode
In the recovery mode, go to utilities and select terminal
in the terminal type csrutil disable
Reboot your mac and redo the redis install by pecl
Should work.

Related

Install grpc extension on Mac OS Big Sur

For 2 days now, I am trying to install grpc for php on my Mac mini server
Mac OS Big Sur 11.2.1
Built-in Apache
I have tried it on php 7.3 and 7.4 installed with homebrew
I have installed grpc pecl grpc install after a bunch of attempt I have finally compile and installed it with pecl.
extensions are placed in the good repertory. But I encounter signing issue.
php -m show grpc in the list but not php_info()
PHP Warning: PHP Startup: Unable to load dynamic library 'grpc.so' (tried: /usr/local/lib/php/pecl/20190902/grpc.so (dlopen(/usr/local/lib/php/pecl/20190902/grpc.so, 9): no suitable image found. Did find:\n\t/usr/local/lib/php/pecl/20190902/grpc.so: code signature in (/usr/local/lib/php/pecl/20190902/grpc.so) not valid for use in process using Library Validation: mapping process is a platform binary, but mapped file is not\n\t/usr/local/lib/php/pecl/20190902/grpc.so: stat() failed with errno=1), /usr/local/lib/php/pecl/20190902/grpc.so.so (dlopen(/usr/local/lib/php/pecl/20190902/grpc.so.so, 9): image not found)) in Unknown on line 0
I have disabled SIP. Still same issue.
I have codesigned the extension with my apple developper ID. codesign -f -s "Mac Developer: MY_DEV_ID" /usr/local/lib/php/pecl/20190902/grpc.so
same issue
I have xattr /usr/local/lib/php/pecl/20190902/grpc.so
then sudo xattr -d com.apple.quarantine /usr/local/lib/php/pecl/20190902/grpc.so
I also tried with gatekeeper disabled.
And still the same problem. Is there someone that sucssefully installed grpc on the Mac with Big Sur, who would have an idea on what is going wrong ?
I experienced the same thing, I have tried several times to install it and I just solved the problem.
In my case when running
sudo pecl grpc install
there was an error in the installation process with error information like
ERROR: failed to mkdir /usr/local/Cellar/php#7.4/7.4.15/pecl/20190902
see in the picture:
running pecl grpc install
The problem is that the installation process can't create a new directory for /usr/local/Cellar/php#7.4/7.4.15/pecl/20190902, so I tried to create that directory first by running the command:
mkdir /usr/local/Cellar/php#7.4/7.4.15/pecl/
Then run the installation process again and and it worked!
1. See Cellar/php/... directory:
for me:
for you:
ls -la /usr/local/Cellar/php/YOUR_PHP_VERSION/
2. See the directory "pecl" which is a link:
3. Check the link:
ls -la /usr/local/lib/php/pecl
if:
No such file or directory
execute:
mkdir -p /usr/local/lib/php/pecl
sudo chmod 777 /usr/local/lib/php/pecl/
4. Reinstall extension:
pecl install grpc

How to install Homebrew Portable Ruby when your system version is too old

I'm trying to install Homebrew on macOS. Once the installation finished, when I typed help I got:
Already downloaded: /.../Library/Caches/Homebrew/portable-ruby-2.6.3.mavericks.bottle.tar.gz
Error: Checksum mismatch.
Expected: ab81211a2052ccaa6d050741c433b728d0641523d8742eef23a5b450811e5104
Actual: f80fd4cc877a64b0ac1c105fdc212ca6be08bb034118900f2c2f58edcfe0dafd
Archive: /.../Library/Caches/Homebrew/portable-ruby-2.6.3.mavericks.bottle.tar.gz
To retry an incomplete download, remove the file above.
Error: Failed to install Homebrew Portable Ruby (and your system version is too old)!
I had the same question, and the solution is simple: remove the portable-ruby-2.6.3.mavericks.bottle.tar.gz you downloaded before.
rm /.../Library/Caches/Homebrew/portable-ruby-2.6.3.mavericks.bottle.tar.gz
Try running brew update-reset in your terminal and then run brew upgrade in the same terminal.
"Homebrew install fails with Error: Failed to install Homebrew Portable Ruby" helped me tremendously.
It would fail to install, because our company firewall was blocking certain downloads, like bottle, during the Homebrew update/install, but it was difficult to determine this because I would get the error above.
After removing the file, try
brew upgrade
brew update
on your personal Wifi or your phone's hotspot.
I fixed it.
First, I deleted the brew file that stores in the Library folder when using macOS.
The failure before was due to the connection. When I make sure the connection worked, it worked.
Remove the Homebrew Portable Ruby tar.gz from your Mac using:
rm <the path.tar.gz>
rm -rf <the path.tar.gz>
I've been automating this for years. There is a new something(?) in play during the Homebrew install.
I had the same error as above. I filed an issue report and got a response that fixed my problem:
CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
I'm not sure what prefixing with CI=1 does but all my automation issues went away.
To retry an incomplete download, remove the file above, then run:
rm /.../Library/Caches/Homebrew/portableruby-2.6.3.mavericks.bottle.tar.gz
and try again
my problem was:
Already downloaded: ../Library/Caches/Homebrew/portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz
==> Pouring portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz
Error: Failed to install ruby 2.6.8_1!
Error: Failed to install Homebrew Portable Ruby (and your system version is too old)!
Fixed with opening the system app for terminal and installing Rosetta into the prompt. This happened after system update MacOS to 11.6.7
After resolving this brew did brew upgrade finish well.
Hope this helps someone.
Here is how I fixed it:
brew cleanup then brew upgrade

Installing Homebrew + nginx + rtmp in macOS Movaje 10.14

I was able to install Homebrew + nginx + rtmp in macOS High Sierra 10.13. Now I want do the same on macOS Mojave 10.14.
So let's start ... istallation of Homebrew, first we need Xcode in terminal...
xcode-select –install
than. We need homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
than install nginx + rtmp
And here's the problem
I tried:
brew install nginx-full --with-rtmp-module
but it won't work
the result:
Updating Homebrew...
Usage: brew install [options] formula
Install formula. Additional options specific to formula may be appended to the command.
Unless HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will then be run for
the installed formulae or, every 30 days, for all formulae.
-d, --debug If brewing fails, open an interactive
debugging session with access to IRB or a
shell inside the temporary build directory.
--env If std is passed, use the standard build
environment instead of superenv. If super
is passed, use superenv even if the formula
specifies the standard build environment.
--ignore-dependencies An unsupported Homebrew development flag to
skip installing any dependencies of any
kind. If the dependencies are not already
present, the formula will have issues. If
you're not developing Homebrew, consider
adjusting your PATH rather than using this
flag.
--only-dependencies Install the dependencies with specified
options but do not install the formula
itself.
--cc Attempt to compile using the specified
compiler, which should be the name of the
compiler's executable, e.g. gcc-7 for GCC
7. In order to use LLVM's clang, specify
llvm_clang. To use the Apple-provided
clang, specify clang. This option will
only accept compilers that are provided by
Homebrew or bundled with macOS. Please do
not file issues if you encounter errors
while using this option.
-s, --build-from-source Compile formula from source even if a
bottle is provided. Dependencies will still
be installed from bottles if they are
available.
--force-bottle Install from a bottle if it exists for the
current or newest version of macOS, even if
it would not normally be used for
installation.
--include-test Install testing dependencies required to
run brew test formula.
--devel If formula defines it, install the
development version.
--HEAD If formula defines it, install the HEAD
version, aka. master, trunk, unstable.
--fetch-HEAD Fetch the upstream repository to detect if
the HEAD installation of the formula is
outdated. Otherwise, the repository's HEAD
will only be checked for updates when a new
stable or development version has been
released.
--keep-tmp Retain the temporary files created during
installation.
--build-bottle Prepare the formula for eventual bottling
during installation, skipping any
post-install steps.
--bottle-arch Optimise bottles for the specified
architecture rather than the oldest
architecture supported by the version of
macOS the bottles are built on.
-f, --force Install without checking for previously
installed keg-only or non-migrated
versions.
-v, --verbose Print the verification and postinstall
steps.
--display-times Print install times for each formula at the
end of the run.
-i, --interactive Download and patch formula, then open a
shell. This allows the user to run
./configure --help and otherwise
determine how to turn the software package
into a Homebrew package.
-g, --git Create a Git repository, useful for
creating patches to the software.
-h, --help Show this message.
Error: invalid option: --with-rtmp-module
so i tried:
brew install nginx --with-rtmp-module
but.....result:
Updating Homebrew...
Error: No available formula with the name "–with-rtmp-module"
==> 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.
so I decided to try install nginx first and than rtmp module
brew install nginx
and than i tried:
brew install nginx libnginx-mod-rtmp (copying from Linux)
brew install rtmp-module
brew install module-rtmp
But none of the above worked. How do I resolve it?
You should tap a nginx formulae before try install nginx-full
Well you can try denji/nginx, since homebrew/nginx tap has been deprecated, That's:
brew tap denji/nginx
then
brew install nginx-full --with-rtmp-module
That works for me.

Unable to install OpenVPN on macOS - configure: error: lzo enabled but missing

I'm trying to install OpenVPN on macOS High Sierra
I have cloned the github repo:
git clone https://github.com/OpenVPN/openvpn
And switched to the latest stable branch:
git checkout origin release/2.4
But when I tried to build the project (following the INSTALL instructions):
autoreconf -i -v -f
./configure
I had this error during the configure step:
configure: error: lzo enabled but missing
Even after installing lzo dependency with macos ports, the problem persists.
The answer to this problem was easier than I thought...
I had just to define the env vars CFLAGS and LDFLAGS before running configure script:
export CFLAGS="-I/opt/local/include"
export LDFLAGS="-L/opt/local/lib"
./configure
make
sudo make install
UPDATE
If you had to install lzo:
using brew: brew install lzo or brew link lzo in case it already exists
using port: sudo port install lzo
I use a M1 MacBook Pro so freedev's answer did not work. I had to instead include the library from inside the homebrew directories so my final configure command was:
./configure LDFLAGS="-L/opt/homebrew/lib -L/opt/homebrew/opt/openssl#3/lib" CPPFLAGS="-I/opt/homebrew/include -I/opt/homebrew/opt/openssl#3/include"
The following resolved the issue for me:
sudo apt-get install libssl-dev liblzo2-dev libpam0g-dev
I got this fix from this askubuntu.com openvpn lzo enabled but missing question.
More details: I got each of the 3 error messages shown below separately. Each one was resolved, then I got the next. All 3 are resolved with the one command line above. Basically, 3 developer packages were missing.
configure: error: OpenSSL version too old (resolved with libssl-dev)
configure: error: lzo enabled but missing (resolved with liblzo2-dev)
configure: error: libpam required but missing (resolved with libpam0g-dev)
Thanks to all the other answers which helped to confirm things, triangulate to the answer I felt most confident about!

"brew install osm2pgsql" failed

I'm using mac and I want to install osm2pgsql to import OSM data into PostgreSQL.
I execute brew install osm2pgsql in the terminal. (I have already executed brew update).
Here is the output:
==> Downloading https://github.com/openstreetmap/osm2pgsql/archive/v0.82.0.zip
Already downloaded: /Library/Caches/Homebrew/osm2pgsql-0.82.0.zip
==> ./autogen.sh
==> ./configure --with-proj=/usr/local/opt/proj
checking for fork... yes
checking for xml2-config... /usr/bin/xml2-config
checking for xml2 libraries... yes
checking for zlib compression library... no
configure: error: required library not found
READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
And here is the output of executing brew doctor:
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libMonoPosixHelper.dylib
/usr/local/lib/libSFFileMonitor.32.dylib
/usr/local/lib/libSFIPC.32.dylib
/usr/local/lib/libSFIPC.I.dylib
/usr/local/lib/libSFsqlite3.7.4.dylib
/usr/local/lib/libSFSyncEngine.I.dylib
I don't know these dylibs and should I delete them?
What should I do to linstall osm2pgsql?
Or should I give up osm2pgsql and use some other tool to import OSM data into PostgreSQL?
[EDIT 1]
According to http://www.zlib.net/, zlib is already included as part of Mac OS X.
And when I search it in google, I found this https://github.com/josegonzalez/homebrew-php/issues/205 and this https://github.com/josegonzalez/homebrew-php/issues/538
So I execute the following two commands:
brew tap homebrew/dupes
brew install zlib
And the result output is:
==> Downloading http://zlib.net/zlib-1.2.8.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/zlib/1.2.8
==> make install
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/zlib/lib
CPPFLAGS: -I/usr/local/opt/zlib/include
==> Summary
It seems that I don't have to install zlib.
Again I execute brew install osm2pgsql, but it still doesn't work.
[Edit 2]
I give up homebrew and install osm2pgsql via a binary installer.
FYI:
http://wiki.openstreetmap.org/wiki/Osm2pgsql#Binary_Installer
https://github.com/openstreetmap/osm2pgsql/issues/15
I don't know anything about brew but according to the error message you are missing the zlib library. Try to install it first.
And you should keep to osm2pgsql because it is the standard tool to import OSM data into a PostgreSQL database.
You have to edit the formula by using the following command:
brew edit <formula_name>
Then, you have to make the exports needed in the brew env, the best place to do this is in the install function just before the call of
system "./configure", *args
Here are the lines to append
ENV.append 'LDFLAGS', "-L/usr/local/opt/zlib/lib"
ENV.append 'CPPFLAGS', "-I/usr/local/opt/zlib/include"
When it is finished, you just have to run the brew installation again and it will works
I edited the formula, as it was not running on Mac OS X Mavericks either. See the gist which made it install successfully.
https://gist.github.com/christoph-buente/e18584e312bcadfe82e5
And i filed a pull request to the homebrew repository. Hopefully it will be merged:
https://github.com/Homebrew/homebrew/pull/29862

Resources