4

I installed php 5.3.8 from source on Ubuntu 10.10 and now i need mcrypt. I also installed mcrypt from source and restarted apache but still i am not able to see it in my php configuration. I understand i would need a mcrypt.so in my php extensions directory. I have installed a lot of extensions and like xdebug and apc and dont want to go through the pain of installing them again. Now how can i install mcrypt without re-installing php and passing mcrypt as a parameter to configure?

lovesh
  • 183
  • 1
  • 10

2 Answers2

4

Usually where you extracted the source you can find the source for all the modules as well. In this case, I think under the "ext" directory. So from the source folder:

[php-5.3.10]$ cd ext/mcrypt/
[mcrypt]$ phpize
[mcrypt]$ ./configure --your-options-here
[mcrypt]$ make && make install

Then edit your php.ini and add:

extension=mcrypt.so

Finally, restart Apache. And I think that should do it for you.

Sweet
  • 431
  • 2
  • 4
  • but this way i have to do the make and make install steps again. Cant i do it the way we install xdebug. i mean generating the `.so` file for mcrypt – lovesh Feb 05 '12 at 16:39
  • If you run it in the directory I specified, "php-X.YY/ext/mcrypt" it will only build the Mcrypt sources, not all of PHP.The make and make install at the end then will only install the mcrypt.so file. – Sweet Feb 05 '12 at 16:44
  • Alternatively, if you don't feel comfortable running "make install", just run "make" and manually copy the .so file to the extensions directory, as shown by "php -i | grep extension_dir" – Sweet Feb 05 '12 at 16:46
  • i have doing this make and make install and configure for some time but i dont understand the linux build process clearly. can u please forward me to some link which explains the build process clearly? thanks – lovesh Feb 05 '12 at 16:54
  • This explains some of it - http://tldp.org/LDP/LG/current/smith.html - I haven't really seen a good explanation, but so far as I know what happens is "configure" will generate a MakeFile based on your system and its current layout. "Make" executes the default option in the MakeFile, which compiles everything and "make install" executes the "install" function, which (for the most part) just copies files to the correct place. If someone with more knowledge would like to shed additional light on this, please do. :) – Sweet Feb 05 '12 at 17:30
0
cp /usr/bin/php /usr/bin/php_old

Install php from source.

cp /usr/local/bin/php /usr/bin/php

make sure that this entry exists in this file /etc/php.ini

extension=mcrypt.so

restart apache...

MichelZ
  • 11,008
  • 4
  • 30
  • 58