Tim
Tim

Reputation:

Howto make MCrypt and PHP work together on CentOS

I've installed mcrypt on CentOS ( via yum ), but when I try to do a dl() call in A), I get the message in B).

Now, I know that yum has installed mcrypt, but I don't know the location it has put it in. Can I find that out? More importantly, how can I get the latest installed mcrypt working with my PHP system. Many threads suggest you recompile PHP ( ex: http://forums.theplanet.com/index.php?showtopic=26527 ), but I don't know how to do this with CentOS. I've also played with my library paths to no avail. Any help would be greatly appreciated.

Setup

Thanks
Tim

Upvotes: 2

Views: 3311

Answers (2)

TML
TML

Reputation: 12966

Well, I'm going to assume there's some particular reason you can't use the package provided by the CentOS distributors (see here, for one example.) I don't know CentOS, but I can give you a rough roadmap of the steps that would most likely lead to a successful build and install of the mcrypt module for PHP.

  1. Get a copy of the PHP source that matches your distro's compiled version (CentOS may have a package for this)

  2. Install the PHP development pacakges (probably something like "php5-dev") as well as all dependencies to build PHP for your distro (on Debian-based systems, this is done via apt-get build-dep php5, not sure the correct incantation for CentOS).

  3. From the top level directory of the PHP source, cd into ext/mcrypt. In this directory, run phpize (this should have been installed alongside the afore-mentioned CentOS equivalent of php5-dev). This will generate a configure script in ext/mcrypt that will allow you to build mcrypt as a shared module.

  4. From the same ext/mcrypt directory, issue ./configure --help and look at the options available to you. From this point on, it's pretty much like any other Unix app: configure, make, make install.

Upvotes: 0

PHP Bugs
PHP Bugs

Reputation: 1183

Login as a root or Super User to the server and add the below commands


yum install php53-devel
yum install libmcrypt-devel
yum install gcc
wget http://museum.php.net/php5/php-5.3.3.tar.bz2
tar xvjf php-5.3.3.tar.bz2
cd php-5.3.3/ext/mcrypt/
phpize
aclocal
./configure
make
make install
echo "extension=mcrypt.so" > /etc/php.d/mcrypt.ini
service httpd restart

Reference Install PHP 5.3 mcrypt extension on Centos 5.6

Upvotes: 2

Related Questions