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"
Related
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.
short question - how to install php7.1 on OS X Sierra and keep 5.6 as default.
I only want to run php 7.1 in terminal using php7 - and when using php the original 5.6 should be used ...
thanx in advance
tom
There are a number of ways to achieve this. I would install PHPBrew, since that allows you install as many PHP versions as you want without touching the system's PHP version.
I would also install Homebrew as it's likely there will be dependencies you need to resolve with specific extensions.
Another option would be to install PHP7 via Homebrew and alias it to php7. Or you could compile it from source. However, if you plan on having one or more PHP versions readily available alongside the system version then PHPBrew is probably the most flexible option.
Install PHP 5.6:
brew install php56
Install PHP 7.0:
php70
Switch to php5.6 in terminal:
brew unlink php70
brew link php56
Switch to php7.0 in terminal:
brew unlink php56
brew link php70
Source: Switching PHP version on mac with homebrew
maybe someone other is searching for a very clean solution too - here is what finally worked for me perfectly. this is based on the hints and tips from matthew daly and surfer 190 - thanx again!
takes just 5 minutes - here we go ...
first install xcode command line tools (just 160mb instead 4.5gb):
xcode-select --install
then install homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
short test if anything up to here is fine:
brew doctor
install php 7.1:
brew install php71
i found that some have problems with the above direct php install - this resolves these problems - and then try again the php install:
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
make a symlink to the original php-binary that came with osx:
ln -s /usr/bin/php /usr/local/bin/php5
here is the result - now php 7.1 is the default php version - and using php5 will use the old php-binary that came with your osx preinstalled:
php -v
php5 -v
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.
I'm attempting to put together a new laravel application and tried to run php artisan to get the list of commands and it says MCrypt extention required. I am running on OSX Mavericks and ran the mrypt installation from homebrew. So now I"m stuck trying to figure out what I need to do. I am trying to get it ready so I can start messing with Vagrant.
I did go through the commands here through terminal:
brew install libjpeg
brew install pcre
brew install libxml2
brew install mcrypt
So now I'm trying to figure out why its not letting me run other commands and needing mycrpt enabled even though I already installed it.
I did the suggestions below and still when I try and run php artisan it says mycrypt php extention required.
Any ideas?
Assuming php 5.5:
brew install php55-mcrypt
If it doesn't find it:
brew tap josegonzalez/php
brew install php55-mcrypt
If it complains about not having zlib:
brew tap homebrew/dupes
brew tap josegonzalez/php
brew install php55-mcrypt
If you're on a different version of php, just change the php55 to match (php 5.3? brew install php53-mcrypt)
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.