Skip to content

Instantly share code, notes, and snippets.

@lucasgameiro
Forked from n3b/install_mcrypt.sh
Last active April 12, 2020 18:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucasgameiro/8730619 to your computer and use it in GitHub Desktop.
Save lucasgameiro/8730619 to your computer and use it in GitHub Desktop.
Script for installing mcrypt.so extension for PHP 5.3 PHP for OS X 10.8 Mountain Lion
#!/bin/sh
# Script for installing mcrypt.so extension for PHP 5.3.13 (default PHP for OS X 10.8 Mountain Lion)
# Initially forked from https://gist.github.com/n3b/4060272
if [ -z "$PHP_AUTOCONF" ]; then
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
tar xzf autoconf-latest.tar.gz
cd autoconf-*
./configure --prefix=/usr/local
make
sudo make install
fi
mkdir /tmp/mcrypt
cd /tmp/mcrypt
curl --location --progress-bar http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download | tar -zx
curl --location --progress-bar http://museum.php.net/php5/php-`php --version | egrep '^PHP' | cut -d ' ' -f2`.tar.bz2 | tar -zx
cd /tmp/mcrypt/libmcrypt-2.5.8
MACOSX_DEPLOYMENT_TARGET=10.8 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --disable-dependency-tracking
make -j6
sudo make install
cd /tmp/mcrypt/php-`php --version | egrep '^PHP' | cut -d ' ' -f2`/ext/mcrypt/
phpize
MACOSX_DEPLOYMENT_TARGET=10.8 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/usr/bin/php-config
make -j6
sudo make install
cd ~ && rm -rf /tmp/mcrypt
sudo sed -i '' 's/;extension=php_zip.dll/extension=mcrypt.so/g' /etc/php.ini
sudo apachectl restart
@viniciusrezende
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment