mcrypt after homebrew install - php

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)

Related

Homebrew: How install disabled package(php7.1)?

I try to install php7.1 (via command brew install php#7.1) for my work-project on my new macbook, but i got following message:
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.
I can't reject using php7.1 because it requirement of my work.
How can I install php7.1 on MacOS?
Start by making sure brew is up-to-date:
brew update
Normal upgrade
brew upgrade PHP
Normal upgrade does not work in many macOS old Versions.
Upgrade with shivammathur/homebrew-php
brew tap shivammathur/php
brew install shivammathur/php/php#7.1
To switch between versions, use the following command:
brew link --overwrite --force php#7.1
Next steps
Check the current version by running php -v:
If you can then, Restart Nginx or Apache also:
refer Link

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"

Install php72 on MacOS using brew

I'm trying to install php72 using brew.
Actually when I do brew install php72 it's downloading "https://homebrew.bintray.com/bottles/php-7.3.0.mojave.bottle.tar.gz".
So when I check php version it's showing me PHP 7.3.0 (cli).
How can I install exactly php72 and not php73 ?
I found the solution.
Instead of installing php72 you must specify version like this php#7.2.
brew unlink [your actual php version linked]
brew install php#7.2
brew link php#7.2
Installing PHP 7.2 on Mac using Homebrew
Check version
php -v
check brew is up to date
brew update
brew upgrade
Unlink php version which is installed in the system
brew unlink php71
Now final step to download**
brew install php72
export PATH=/usr/local/php5/bin:$PATH
This worked for me
brew upgrade
brew unlink php71
brew install php72
then in your ~/.bash_profile
export PATH=/usr/local/Cellar/php\#7.2/7.2.26/bin/:$PATH
brew tap homebrew/homebrew-php
brew unlink php71
brew install php72 --with-argon2
brew install php72-xdebug
For more info follow url https://murze.be/how-to-upgrade-from-php-71-to-72-on-macos-using-homebrew
Note older version's of Mac OS are not supported, I'm trying with docker which also doesn't support older versions of Mac OS completely (no desktop version). Trying with just docker machine as follows;
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine

OSX Sierra - How to Install PHP7 and leave 5.6 as default in Terminal

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

How to install x-cache on max os?

I have installed already php 5.6 and memcached using http://php-osx.liip.ch/. Now I need x-cache and I don't know how to install and turn module on for php. Please, help. Thank's in advance.
I would suggest you installed Homebrew, fire up a Terminal and run brew install php56-xcache. You might need to run brew tap homebrew/dupes && brew tap homebrew/versions && brew tap homebrew/homebrew-php before you're able to run it.
Also, Homebrew will probably install a new version of PHP 5.6, but it's seriously worth it as easy as a brew install php56-mcrypt if you wanted to install mcrypt (or any other package).

Categories