Apologies in advance for the potential n00b questions, I am trying to install the mcrypt extension for PHP on my OSX Mountain Lion machine.
The following steps in terminal is what I have done so far to achieve my PHP install
cd /path/to/downloaded/php-5.3.21/ext/mcrypt/ /usr/bin/phpize ./configure cd /path/to/downloaded/php-5.3.21 ./configure --with-config-file-path=/private/etc/php.ini --with-apxs2=/usr/sbin/apxs make sudo make install
Which seems to work well and installs PHP 5.3.21 fine. I have then done
sudo nano /private/etc/php.ini
And included
extension=mcrypt.so
Along with an Apache restart, phpinfo() doesn't show that the mcrypt extension is loaded.
I then tried to specify the extension_dir inside php.ini, again with no luck.
I have done
locate mcrypt.so /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so /usr/local/Cellar/php53-mcrypt/5.3.18/mcrypt.so
And tried both directories as the extension_dir, with no luck.
I have also tried the following, after much Googling
./configure --with-config-file-path=/private/etc/php.ini --with-apxs2=/usr/sbin/apxs --with-mcrypt
Which seems to work OK, but then upon "make", it returns
ext/mcrypt/mcrypt.o: No such file or directory ext/mcrypt/mcrypt_filter.o: No such file or directory
Again, no success.
What am I doing wrong? It seems like the physical compile of mcrypt.so is not happening, or is compiling incorrectly as I would suspect there to be another mcrypt.so found under locate?
Anyone please help? I've gone through pages upon pages of Google searches with no luck!
What is mcrypt? The mcrypt extension is a replacement for the UNIX crypt command. These commands serve as a means to encrypt files on UNIX and Linux systems. The php-mcrypt extension serves as an interface between PHP and mcrypt.
You can also achieve this same screen by viewing a php file that has: phpinfo(); somewhere in the code. In this screen, simply search for the string "mcrypt support". If installed, you will see a box that says "enabled".
mcrypt is a replacement for the popular Unix crypt command. crypt was a file encryption tool that used an algorithm very close to the World War II Enigma cipher. Mcrypt provides the same functionality but uses several modern algorithms such as AES.
I tend to use Homebrew on Mac. It will install and configure all the stuff for you.
http://mxcl.github.com/homebrew/
Then you should be able to install it with brew install mcrypt php53-mcrypt
and it'll Just Work (tm).
You can replace the 53
with whatever version of PHP you're using, such as php56-mcrypt
or php70-mcrypt
. If you're not sure, use brew search php
.
Do also remember that if you are using the built in Mac PHP it's installed into /usr/bin
you can see which php you are using with which php
at the terminal and it'll return the path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With