How To Enable Php Mcrypt on Mac Os X Lion 10.7.4

2019-07-31 09:33发布

问题:

I have been trying to enable mcrypt for two days in OS X. I read lots of document but I could not accomplish. Maybe it is because I am new in OS X environment.

The brief summary what I have done so far is;

I installed Xcode and installed Command Line Tools.

Downloaded and extracted libmcrypt-2.5.8 and php-5.3.15.

cd libmcrypt-2.5.8
./configure && make && sudo make install

The output of this is

Libraries have been installed in:
/usr/local/lib 

and some other logs like

make[2]: Nothing to be done for `install-exec-am'.

The next step is;

cd php-5.3.15/ext/mcrypt
./configure && make && sudo make install

The output of this is

Installing shared extensions:
/usr/lib/php/extensions/no-debug-non-zts-20090626/

According to documents that I read, this means the installation is successful. After all these I opened /etc/php.ini and wrote extension=mcrypt.so. I restarted apache with sudo apachectl restart. But nothing happened. Mcrypt did not appear in php -m.

I also tried to install mcrypt with sudo port install php-mcrypt +universal but also this did not worked.

I saw another topic which is related to this problem and there was an answer which says that changing extension=mcrypt.so with full path of mcrypt.so. I tried and that is also not worked for me.

回答1:

I found this walkthrough useful, http://www.coolestguyplanettech.com/how-to-install-mcrypt-for-php-on-mac-osx-lion-10-7-development-server/



回答2:

Make sure 'extension_dir' property is set in your php.ini or if its already there check that its not commented.