Showing posts with label mcrypt. Show all posts
Showing posts with label mcrypt. Show all posts

Thursday, June 10, 2010

Installing PHP mcrypt extension under Snow Leopard (Mac OS X Version 10.6.3)


Step 1


Enable php in /etc/httpd.conf by uncommenting (remove # at the start of line) the following line


LoadModule php5_module libexec/apache2/libphp5.so


Step 2


a) Download libmcrypt from
http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.bz2/download

b) Extract the contents to ~/Downloads/libmcrypt-2.5.8

c) In Terminal type the following commands

cd ~/Downloads/libmcrypt-2.5.8/
./configure --disable-posix-threads --enable-static
make
sudo make install


Step 3


a) Download source code of PHP 5.3.0 from
http://us2.php.net/get/php-5.3.0.tar.gz/from/a/mirror

b) Extract the contents to ~/Downloads/php-5.3.0

c) In Terminal type the following commands
cd ~/Downloads/php-5.3.0/ext/mcrypt
phpize
./configure
make
cd modules

sudo cp mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/

Step 4


a) Set your default timezone in php.ini located at /etc. Mine is


date.timezone = Asia/Kolkata


b) Enable the mcrypt extension by typing/editing the following in php.ini


extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so


Step 5


Restart apache with the following command in Terminal


sudo apachectl restart


Step 6


1) Test your php installation by creating a test.php file in /Library/WebServer/Documents
with the following contents

<?php
phpinfo();
?>
2) Open a browser and go to http://127.0.0.1/test.php which should
list the version and other details regarding PHP.
You should also see a section with mcrypt details.