Linux下编译PHP时遇到的安装libmcrypt库的问题
./configure –prefix=/usr/local/php-5.2.3 –enable-module=so –with-mysql=/usr/local/mysql-5.1.20 –with-apxs2=/usr/local/apache-2.2.4/bin/apxs –enable-mbstring –with-mcrypt
通过以上命令配置PHP时,遇到错误,总说找不到libmcrypt。由于这服务器是个裸机,很多必须的库都没装,必须一个一个的手动安装,可libmcrypt这个库我的确装过了。重试n遍,无解。在网上找了半天,终于在phpbuilder.com的一个maillist里发现一个哥们儿遇到的问题跟我差不多,按照他的方法做了一下,居然解决了。原文在这:http://www.phpbuilder.com/lists/php-install/2004032/0090.php
做为一个懒人,我就不逐句翻译了,摘抄解决办法如下:
——————————-
the solution
——————————-
Then I visited
http://mcrypt.hellug.gr/mcrypt/index.html
an learned that I have to install not only libmcrypt
but also mcrypt and libmhash.
Here is the to do:
libmcrytp:
———–
download libmcrypt-xxx.tar.gz
create the following directory: / usr / local / libmcrypt
copy the libmcrypt-xxx.tar.gz into that directory and move to it
run the following shell (>) commands: (’xxx’ is the version number)
> gunzip -c libmcrypt-xxx.tar.gz | tar xf –
> cd libmcrypt-xxx
> ./configure –disable-posix-threads
> make
> make check (note: ‘make check’ is optional)
> make install
then (update your environment) add in / etc / profile the following path:
/usr/local/libmcrypt/libmcrypt-xxxx
(note: as I run Red Hat 7.3 I set the line a f t e r the if-part
(id -u = 0 …) with: pathmunge /usr/local / libm….)
and add in / etc / ld.so.conf the following path: /usr/local/lib
then run ldconfig:
> ldconfig
now comes the important part:
> cd /usr/local/libmcrypt/libmcrypt-xxx/libltdl
> ./configure –enable-ltdl-install
> make
> make install
(maybe not needed: I also added a link in / usr / bin: )
(> cd /usr/bin)
(> ln -s /usr/lib/libltdl.so.3.1.0 ltdl)
mhash:
———–
download mhash-xxx.tar.gz
create the following directory: / usr / local / mhash
copy the mhash-xxx.tar.gz into that directory and move to it
run the following shell (>) commands: (’xxx’ is the version number)
> gunzip -c mhash-xxx.tar.gz | tar xf –
> cd mhash-xxx
> ./configure
> make
> make check (note: ‘make check’ is optional)
> make install
mcrypt:
———–
download mcrypt-xxx.tar.gz
create the following directory: / usr / local / mcrypt
copy the mcrypt-xxx.tar.gz into that directory and move to it
run the following shell (>) commands: (’xxx’ is the version number)
> gunzip -c mcrypt-xxx.tar.gz | tar xf –
> cd mhash-xxx
> ./configure
> make
> make check (note: ‘make check’ is optional)
> make install
back to PHP:
————–
move into your PHP installation directory
then the following command worked on my computer:
>
./configure –with-apache=/usr/local/apache/apache_1.3.29 –with-mysql –wit
h-mcrypt=/usr/local/mcrypt/mcrypt-2.6.4
> make
> make install