installing amqp on mac with brew - php

I wanted to install amqp with pecl for my mac sierra.
I installed php with brew, with pecl install amqp I receive an error: checking for amqp using pkg-config... configure: error: librabbitmq not found
I installed with brew the librabbitmq-c package but I still get this error. I think it's somehow not synced with the pkg-config.
Does someone have an idea what to do here?

First install rabbitmq-c with brew:
brew search librabbitmq
No formula or cask found for "librabbitmq".
Closed pull requests:
Add rabbitmq-c (aka librabbitmq) formula (https://github.com/Homebrew/legacy-homebrew/pull/13437)
brew install rabbitmq-c
Then install amqp with pecl:
pecl install amqp
Set the path to librabbitmq:
Set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.9.0
Verify that amqp is now installed:
php -i|grep amqp

Thanks for this walk through, it was super helpful. Just a quick note, in Mac OS 12.0.1 Monterey, the default install path for rabbitmq in homebrew is:
/opt/homebrew/Cellar/rabbitmq-c/0.11.0

I'm on MacOS High Sierra. I installed the Command_line_Tools_macOS_10.13_for_Xcode_10.1.dmg from developer.apple.com and brew installed php 8.
For the amqp extension, I used:
brew install rabbitmq-c
pecl install amqp-1.11.0beta
at the prompt
Set the path to librabbitmq install prefix [autodetect] :
I entered:
Set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.11.0

The issue lies with pkg-config not being able to generate libs/cflags for librabbitmq.
$ pkg-config librabbitmq --cflags
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'librabbitmq', not found
What I did was to add both rabbitmq-c and openssl to $PKG_CONFIG_PATH as below:
export PKG_CONFIG_PATH="/usr/local/Cellar/rabbitmq-c/0.10.0/lib/pkgconfig:/usr/local/opt/openssl#1.1/lib/pkgconfig"
Then the build will succeed. (Note: I built mine with phpbrew rather than pecl, but should work).

Brew doesn't add the file to the pkg-config path, so it needed a command:
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/Cellar/rabbitmq-c/0.9.0/lib/pkgconfig"

Before installing make sure the taps are up-to-date:
brew update
Then, install RabbitMQ server with:
brew install rabbitmq
In case that directory is not in PATH it's recommended to append it:
export PATH=$PATH:/usr/local/sbin

It's a combination of question and both previous answers which worked for me.
First install RabbitMQ through brew as rabbitmq-c. Then with PECL but add the config path when asked: /usr/local/Cellar/rabbitmq-c/0.10.0
Needs to be adjusted with your installed brew version of RabbitMQ.

On my M1 Mac Pro, PHP 8.2.1 the PECL install amqp rabbbitmq path it wanted is /opt/homebrew/Cellar/rabbitmq-c/0.11.0/
Hope this helps someone.

Related

Cannot install mcrypt with homebrew and php7.4

OS: macOS 11 (big sur)
Homebrew: 2.5.12
PEAR Version: 1.10.12
I just upgraded the php on my mac from php7.1 to php7.4 with homebrew (brew install php#7.4).
Then, when I try to install mcrypt extension, I got the error:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
ERROR: `/private/tmp/pear/install/mcrypt/configure --with-php-config=/usr/local/homebrew/opt/php#7.4/bin/php-config --with-mcrypt' failed
Here is what I did:
brew isntall mcrypt
install the pecl
sudo pecl install mcrypt -- The error goes here.
What I tried:
Located the mcrypt.h and put manually the file to the several locations (based on the php-config), not work.
Cleaned the brew and reinstall/relink the mcrypt(libmcrypt), not work.
Removed the legacy mcrypt files of the old brew version.
I ran into the same problem. So after installing libmcrypt with brew install mcrypt it seems like configure is not able to resolve the path to mcrypt.h automatically. It also does not work to specify the CPPFLAGS or giving the homebrew include path.
But I found a solution that works for me by giving pecl the install location of mcrypt in the Homebrew Cellar. This is what the following code does automatically:
pecl install mcrypt <<<"$(ls -d $(brew --prefix)/Cellar/mcrypt/* | tail -1)"
if you using brew try this :
1.Unistall existing php then Install shivammathur/php
add shivammathur php
brew tap shivammathur/php
change php version with you needed (5.6 or 7.2 or 7.4 or 8.1 or next version)
brew install shivammathur/php/php#7.4
2.Install shivammathur/extensions it s will add extension to php
then
brew tap shivammathur/extensions
brew install shivammathur/extensions/mcrypt#7.4
then you install mcrypt with same version as php version
brew install mcrypt#7.4
then restart httpd
brew services restart httpd
Ref :
https://github.com/shivammathur/homebrew-php
https://github.com/shivammathur/homebrew-extensions
The problem here is the configure command can't find the libmcrypt installed by homebrew
You can
Download the source code of mcrypt-1.0.4, then cd in the folder
run "phpize"
run "./configure --with-mcrypt=/opt/homebrew/Cellar/mcrypt/2.6.8", you can change the path here with your path for homebrew lib
run "make && make install"
add extension=mcrypt.so to your config file
ps: Use php -i | grep "Loaded Configuration File" to locate your php configure file
in case of an error on macOS use the complete path in php.ini like:
extension="/opt/homebrew/Cellar/php/8.1.9/pecl/20210902/mcrypt.so"

Trying to install int extension macOS Catalina and PHP 7.4.10

I am trying to install the zip and the intl extension for PHP 7.4.10
I run
sudo pecl install intl
and then the installation is requesting :
Specify where ICU libraries and headers can be found [DEFAULT] :
then I hit enter and continues but then it shows the next error:
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found
then I start to look how to install icu, I run:
brew install icu4c
the console shows:
If you need to have icu4c first in your PATH run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> /Users/user/.bash_profile
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> /Users/user/.bash_profile
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
For pkg-config to find icu4c you may need to set:
export .bash_profile="/usr/local/opt/icu4c/lib/pkgconfig"
I added all the paths to the .bash_profile config file and run:
source .bash_profile
at this point I am not sure what todo I am still receiving:
== Environment ==
!! php_extension zip !!
[System] must be installed and enabled - The Zip PHP extension is now required by Moodle, info-ZIP binaries or
PclZip library are not used anymore.
!! php_extension intl !!
[System] must be installed and enabled - Intl extension is required to improve internationalization support, such as
locale aware sorting and international domain names.
even after run sudo apachectl restart
also I have check a lot of guides to install the zip extension via php.ini adding extension=zip but is not working
any help will be appreciated
[UPDATE]I tried to use the fist answer to the post and I got after run all and the last command output was sudo pecl update-channels && sudo pecl install intl
checking for icu-uc >= 50.1 icu-io icu-i18n... no
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:
No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: `/private/tmp/pear/temp/intl/configure --with-php-config=/usr/local/opt/php/bin/php-config --with-icu-dir=/usr/local/opt/icu4c' failed
Is icu4c present on your system ? What is the output of:
which icu4c
If you have no output we can investigate further. A quick look at the ICU documentation tell us that the library relies on autoconf.
brew update
brew install autoconf automake libtool
brew install icu4c
Now let's check if icu4c is installed properly
which icu4c
If at this point you still have no output then it's better to install and compile icu4c from source.Because this library installed via Homebrew could be suffering from multiple issues.
wget https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz
tar xvfz icu4c-67_1-src.tgz
cd icu/source
./configure --prefix=/usr/local/opt/icu4c/67_1 --enable-icu-config
sudo make && sudo make install
Afterwards you can resume
sudo pecl update-channels && sudo pecl install intl
If you will be asked
Specify where ICU libraries and headers can be found [DEFAULT] :
The answer is
/usr/local/opt/icu4c
When icu4c is installed with brew, it doesn't copy its files to pkg-config configuration directory.
So, another workaround would be to be to set the PKG_CONFIG_PATH to the folder where the lib is located. Example:
PKG_CONFIG_PATH=/usr/local/Cellar/icu4c/69.1/lib/pkgconfig/ pkg-config --cflags --libs libsoup-2.4

Pecl install sqlsrv returns No releases available for package

While installing sqlsrv module for PHP7 i'm getting following error -
No releases available for package "pecl.php.net/sqlsrv
Command used
sudo pecl install sqlsrv
Any idea how to resolve this issue?
Same problem here... Solved installing modules as root this way (Ubuntu 16.04):
wget http://pecl.php.net/get/sqlsrv-4.3.0.tgz
pear install sqlsrv-4.3.0.tgz
wget http://pecl.php.net/get/pdo_sqlsrv-4.3.0.tgz
pear install pdo_sqlsrv-4.3.0.tgz
You can check latests available versions here: http://pecl.php.net/package-search.php?pkg_name=sqlsrv&bool=AND&submit=Search
And check if php modules are enabled after installation:
php -m | grep sqlsrv
Try to install a certain version that you know exists:
$ pecl install sqlsrv-4.3.0
Also try to clear the cache:
$ pear clear-cache
For corporate proxy users, you might just need to tell pear to use your proxy.
pear config-set http_proxy http://proxy.example.com:8080
Sometimes pecl.php.net is not available or down. In this case pecl install may show "no releases available".
Just for information.

How to install V8js on PHP5.5?

I want to install the v8js extension for PHP5.5 on Ubuntu 12.04 but can't make it working.
When I try to install the v8js extension version 0.2.0 (latest) with PECL, I have this message:
configure: error: libv8 must be version 3.24.6 or greater
ERROR: `/tmp/pear/temp/v8js/configure --with-v8js' failed
If I try to install an old version, I have a compilation error. This message is very similar to my issue: Install v8js for php on ubuntu
How can I fix this issue?
EDIT: I couldn't install it on Ubuntu 14.04 with PHP5.5, even with a PHP downgrade with PHPbrew to PHP 5.4. However, using Ubuntu 12.04 with PHP 5.4 works great. I didn't try the downgrade from PHP 5.5 to 5.4 on Ubuntu 12.04.
in case you can't find libv8-dev or libv8-dbg, you can find the correct version by run command
~$ apt-cache search libv8
libv8-3.14-dbg - V8 JavaScript engine - debugging symbols
libv8-3.14-dev - V8 JavaScript engine - development files for 3.14 branch
libv8-3.14.5 - V8 JavaScript engine - runtime library
libv8-dev - V8 JavaScript engine - development files for latest branch
then you can run
~$ sudo apt-get install libv8-3.14-dev libv8-3.14-dbg g++ cpp
then you can try to install v8js via pecl by running
~$ sudo pecl install v8js-0.2.0
if that command return error like this
configure: error: libv8 must be version 3.24.6 or greater
ERROR: `/tmp/pear/temp/v8js/configure --with-v8js' failed
you can try to install v8js-0.1.3 instead by running
~$ sudo pecl install v8js-0.1.3
then edit your php.ini to add v8js extension
~$ echo "extension=v8js.so" >> /etc/php5/cli/php.ini
Open your terminal/console
sudo apt-get install libv8-dev libv8-dbg g++ cpp
Make an update sudo apt-get update
Try sudo pecl install v8js-0.2.0 (or other version i.e.: sudo pecl install v8js-0.1.3)
Edit your php.ini (Check: Where is my php.ini file?) file by adding: extension=v8js.so.
Restart server
If it the extension still doesn't work, try to edit /etc/php5/conf.d/v8js.ini and add extension=v8js.so and restart server again.
Hope this helps.
These other answers work well and I used v8js-0.1.3 for the past 1.5 years but after needing to upgrade to PHP 7 I needed a better solution as v0.1.3 doesn't compile with PHP 7 (something to do with php_smart_str being renamed to php_smart_string).
After a couple hours of frustrating research and compiling libv8 myself, I didn't want to have to go through this whole process on every server I provisioned.
Anyway, I found this site which points you to a launchpad PPA site that provides a couple different ubuntu packages with the 5.1 and 5.2 libv8 libraries.
I ran these commands (please don't add repositories of 3rd party devs without understanding the risks).
sudo apt-add-repository ppa:pinepain/libv8-5.2
sudo apt-get update
sudo apt-get install libv8-5.2-dev
sudo pecl install v8js-1.1.0
(Thanks #JeyKeu for suggesting to add "apt-get update" to these commands)
I couldn't get v8js-1.3.0 or 1.2.0 to build, but 1.1.0 worked well. I checked the changelog and found that the latest updates are not necessary in my circumstance anyway.

Installing/enabling PHP Pecl Intl extension on a default Mac OS X Leopard bundled PHP configuration

How can I install or enable the PHP Pecl Intl extension in my PHP environment?
I've got a stock PHP configuration that came bundled with Mac OS X Snow Leopard.
Installing libicu from source and than $pecl install intl results in the following error:
/private/tmp/pear/temp/intl/collator/collator_class.c:92: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:96: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:101: error: duplicate 'static'
/private/tmp/pear/temp/intl/collator/collator_class.c:107: error: duplicate 'static'
make: *** [collator/collator_class.lo] Error 1
ERROR: `make' failed
Any help is really appreciated!
Here's what I did in OSX 10.9 Mavericks:
Install some dependencies with Homebrew:
$ brew install autoconf
$ brew install icu4s
$ brew link --force icu4s
Install and verify Pear/PECL (instructions from http://techtastico.com/post/como-instalar-pear-y-pecl-en-os-x-mavericks/):
$ curl -O http://pear.php.net/go-pear.phar
$ sudo php -d detect_unicode=0 go-pear.phar
[ Select 1 and enter /usr/local/pear ]
[ Select 4 and enter /usr/local/bin ]
[ Press return ]
$ pear version
Install PECL intl:
$ sudo pecl install intl
$ sudo cp /private/etc/php.ini{.default,}
$ sudo chmod 644 /private/etc/php.ini
$ echo extension=intl.so >> /private/etc/php.ini
For the time being I've recompiled my PHP installation. I've created a gist with my configure string which I'll keep updating.
update
liip have created a nice binary that circumvents all these troubles. It is based on the original entropy.ch binary, I recomend using it for PHP development on a Mac.
Better late than never, but if you are like me and installed PHP directly from php.net (instead of using something like Homebrew or Port, then you can simply follow the following link to install Pear and PECL:
http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/
It worked fine for me.
on my Mac I installed a php version with pear using brew. This solved all my issues as the default osX php didn't work for me after trying many different ways. You can try without installing php/pear if you have already done so.
You need Homebrew http://brew.sh/
Install PHP
brew install php56 --with-pear or brew install php56 pear
Install autoconf
brew install autoconf
Install icu4c
brew install icu4c
Creates the symlinks
brew link --force icu4c
Install intl with (pearl) pecl
sudo pecl install intl
Homebrew should enable intl and symlink all the right versions to their respective commands.

Categories