OC2PS
OC2PS

Reputation: 1069

How to run PHP 5.5.4 mcrypt run on CentOS 6.4?

I am getting the following error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so)

Does mcrypt require glibc 2.14?

We are running CentOS 6.4 (latest stable version of CentOS) and it comes with glibc 2.12 (can't really upgrade glibc as being a core part of OS, changing it will likely break lots of stuff)

How do I make my PHP 5.5.4 run mcsypt under these circumstances?

Current configuration (phpinfo output) is here.

Upvotes: 1

Views: 6975

Answers (3)

naw103
naw103

Reputation: 1903

I was also having issues installing mcrypt on my VPS dev server so I thought I would post my solution in the hopes that it helps someone. I am running Centos OS 6.5 and had upgraded PHP to 5.5.13 using the Webtatic EL yum repository. https://webtatic.com/packages/php55/

First shh into your server

ssh [email protected]

initially I was trying to do (which was not working):

yum update
yum install php-mcrypt

I then realized my mistake when I looked at php -v and realized php-common was conflicting as the above code was trying to load a dependency from 5.3.

I then executed the following correct commands:

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum update
yum install php55w-mcrypt
service httpd restart

This worked perfectly for me.

I also read while researching this issue that some people did have to add the extension to their .ini file manually by adding the following line but i did not have to do this.

extension=mcrypt.so

you can find the location of your php.ini file by looking at phpinfo(); and see which configuration it is loading. For me the following ini files were loading:

/etc/php.ini
/etc/php.d/mcrypt.ini
/var/www/vhosts/system/domain.com/etc/php.ini

If the installation is successful then you will see the extension when you echo phpinfo();

mcrypt in php info

Upvotes: 3

Machavity
Machavity

Reputation: 31614

Try installing php-mcrypt using yum. That should pull in any other libraries you need to run it.

yum install php-mcrypt

Upvotes: 2

Diemuzi
Diemuzi

Reputation: 3527

In light of your update, it would appear that you are trying to use the MCrypt extension built from another PHP Source which was created by an updated GLIBC library. The only proper solution I can see is the following:

You first need to ensure you have libmcrypt, libmcrypt-devel, and mcrypt installed before continuing. Check your CentOS repository.

  1. Download the PHP Source from http://php.net
  2. Untar the downloaded source tar -zxf php-5.5.4.tar.gz
  3. cd into the source cd php-5.4.4
  4. Copy your current ./configure string. The whole thing!
  5. Add support for Mcrypt --with-mcrypt=/usr and run the new configure command
  6. make && make install
  7. restart Apache and PHP-FPM

This will keep your current configuration just as CentOS has built it but with the additional support of MCrypt as you are looking to have. Once you've done this, you do not need to enable the MCrypt extension in your php.ini file as it will be built into PHP itself and will be automatically loaded for you now.

When in doubt, you can also read up on the installation here https://www.php.net/manual/en/mcrypt.installation.php

Upvotes: 0

Related Questions