MCrypt is a replacement for older crypt() package and crypt(1) command with extensions. It allows developers encryption functions, specifically allowing users to encrypt files or data streams.
Configuring MCrypt support for Mod_PHP can be a pain so hopefully this article will help!
The below was tested on a Centos 4.4 64 Bit server.
Package Dependencies:
libmcrypt-2.5.8.tar.gz
mhash-0.9.9
mcrypt-2.6.4
php-5.2.1.tar.gz
Installation Notes:
libmcrypt:
gunzip -c libmcrypt-2.5.8.tar.gz | tar xf -
cd libmcrypt-xxx
./configure --disable-posix-threads
make
make check (note: 'make check' is optional)
make install
added /usr/local/lib to ld.so.conf
ldconfig or LD_LIBRARY_PATH=/usr/local/lib
(Below is important)
cd libmcrypt-2.5.8/libltdl
./configure --enable-ltdl-install
make
make install
mhash:
ldconfig
gunzip -c mhash-0.9.9.tar.gz | tar xf -
cd mhash-xxx
./configure
make
make check (note: 'make check' is optional)
make install
mcrypt:
ldconfig
gunzip -c mcrypt-2.6.4.tar.gz | tar xf -
cd mcrypt
./configure
make
make check (note: 'make check' is optional)
make install
PHP:
gunzip -c php-5.2.1.tar.gz | tar xf -
./configure --with-apxs2=/usr/sbin/apxs --with-jpeg-dir=lib64
--BLAH --BLAH --BLAH --with-mcrypt=/path/to/mcrypt-2.6.4
(*NOTE the path of --with-mcrypt= install directory source code)
make
make install
This should get you up and running to use mcrypt!
Any idea if MCrypt works on Solaris 9 64-bit, php 4.3 and Apache 1.x?
I tried to compile libmcrypt 2.5.8, but got following error:
/usr/local/lib/sparcv9/libstdc++.so.5: wrong ELF class: ELFCLASS64
Does that mean I am using the 64-bit lib to compile the 32-bit source? Any idea as how to fix it?
thanks
I haven’t personally installed MCrypt on Solaris 9 64-bit, however the error you are getting does appear to be a mismatch of 32bit and 64bit lib and compile.
I recall reading somewhere the default flags, in common/Makefile.common, for v9 sol8 64 specify 64-bit compilation via the -m64 flag.
I did my compile on a 1950 Dell 64bit Centos server btw, but in 32bit mode.
I got no errors when configured libmcrypt 2.5.8, mhash 0.9.9 and mcrypt 2.6.7. and php 4.3.10. But, fail to start the HTTP server: the error is Syntax error on line 233 of /usr/oracleAS904/Apache/Apache/conf/httpd.conf:
Cannot load /usr/oracleAS904/Apache/Apache/libexec/libphp4.so into server: ld.so.1: httpd: fatal: libgcc_s.so.1: open failed: No such file or directory.
Following parameters were used when configuring PHP:
./configure –enable-wddx –with-zlib –with-apxs=$OAS_HOME/Apache/Apache/bin/apxs –with-config-file-path=$OAS_HOME/Apache/Apache/conf –with-oci8=$OAS_HOME –prefix=$OAS_HOME –with-mcrypt=$OAS_HOME/libmcrypt/mcrypt-2.6.7
I know the problem is with mcrypt. When configured without mcrypt, HTTP server is able to start: ./configure –enable-wddx –with-zlib –with-apxs=$OAS_HOME/Apache/Apache/bin/apxs –with-config-file-path=$OAS_HOME/Apache/Apache/conf –with-oci8=$OAS_HOME –prefix=$OAS_HOME
Don’t know what’s wrong with the mcrypt setup?
thanks in advance.
Prior to the execution of php ‘configure’, any need to modify files: httpd.conf and php.ini ?
thanks
No need to modify httpd.conf or php.ini prior to the execution of the ./configure of PHP.
Regarding the error you are getting 3 things:
the error is Syntax error on line 233 of /usr/oracleAS904/Apache/Apache/conf/httpd.conf:
Cannot load /usr/oracleAS904/Apache/Apache/libexec/libphp4.so into server: ld.so.1: httpd: fatal: libgcc_s.so.1: open failed: No such file or directory.
1) Where is your libgcc_s.so.1 ?
I have that particular shared object in:
/lib/libgcc_s.so.1
/lib64/libgcc_s.so.1
I would find your libgcc_s.so.1 file and set your:
LD_LIBRARY_PATH or equivelent in your .bashrc file or equivilent
export LD_LIBRARY_PATH=/var/lib/mysql:/usr/local/lib:/usr/lib:/lib
don’t forget to source it. For the make of apache.
2) Another thing is what version of GCC are you running, it’s possible you may need to recompile your Apache with the same GCC version as the other packages you are compiling for mcrypt.
I use GCC 3.4.6 its possible you compiled apache with an older version of GCC and now are using a newer version for mcrypt.
3) You have GCC compiled in a non standard location see the below link for info about that possible cause:
http://archives.postgresql.org/pgsql-admin/2002-09/msg00016.php
—
Bottom line I think its a pathing issue or a mis-match GCC version issue or a non standard GCC location issue.
-Phil