-
-
Save BernardoSilva/221bcd4e05fc738d9e35 to your computer and use it in GitHub Desktop.
Compile and install mcrypt.so PHP extension for Mac OS X Mountain Lion, Yosemite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
# NOTE: To execute this script: bash install_mcrypt.sh | |
# Pre Reqs, These are important!!! | |
# Install xCode | |
# Launch xCode and open Preferences | |
# Select the Downloads Tab in the Preference Panel | |
# Under Components install Command Line Tools | |
# Scipt for installing mcrypt.so extension for PHP 5.3.26 (default PHP for OS X 10.8 Mountain Lion) | |
# If your PHP Version is different you can find it here: http://www.php.net/releases/ | |
mkdir /tmp/mcrypt | |
cd /tmp/mcrypt | |
PHP_VERSION=`php -v | cut -d' ' -f2 | head -n 1` | |
echo "Begin instalation of mcrypt for PHP $PHP_VERSION" | |
# libmcrypt | |
cmd_get_mcrypt="curl -o libmcrypt-2.5.8.tar.gz --location --progress-bar http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download" | |
cmg_extract_libmcrypt='tar -zxf libmcrypt-2.5.8.tar.gz' | |
echo 'Installing libmcrypt...' | |
$cmd_get_mcrypt | |
echo "Extracting files..." | |
$cmg_extract_libmcrypt | |
# your version of PHP | |
#curl --location -progress-bar http://museum.php.net/php5/php-5.5.14.tar.gz | tar -zx | |
cmd_get_php="curl -O --location --progress-bar http://museum.php.net/php5/php-$PHP_VERSION.tar.gz" | |
cmd_extract_php="tar -zxf php-$PHP_VERSION.tar.gz" | |
echo "Downloading PHP $PHP_VERSION..." | |
$cmd_get_php | |
echo "Extracting files..." | |
$cmd_extract_php | |
#autoconf | |
echo "Downloading autoconf..." | |
curl --location -progress-bar http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz | tar -zx | |
echo "Building mcrypt..." | |
cd /tmp/mcrypt/libmcrypt-2.5.8 | |
MAC_OS_X_VERSION_MIN_REQUIRED=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 | |
echo "building autoconf..." | |
cd /tmp/mcrypt/autoconf-2.69/ | |
MAC_OS_X_VERSION_MIN_REQUIRED=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 | |
make -j6 | |
sudo make install | |
cmd_goto_mcrypt_extension="cd /tmp/mcrypt/php-$PHP_VERSION/ext/mcrypt/" | |
$cmd_goto_mcrypt_extension | |
phpize | |
MAC_OS_X_VERSION_MIN_REQUIRED=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 | |
echo "Don't forget to add 'extension=mcrypt.so' to sudo vi /etc/php.ini and restart apache: sudo apachectl restart" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment