CentOS下安装mcrypt库

我又来找虐了,在mac上弄完php的环境现在开始在centOS上装php7的环境玩。。。
在装mcrypt环境之前需要安装libmcrypt库,libmcrypt库安装挺简单,直接用源码包./configure --prefex=/usr/local/libmcrypt -》make->sudo make install就ok了,接下来安装mcrypt库才是重点。(--prefex表示安装路径)


刚开始,解压mcrypt的源码包,./configure编译,报错。

checking for libmcrypt – version >= 2.5.0… no
*** Could not run libmcrypt test program, checking why…
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means LIBMCRYPT was incorrectly installed
*** or that you have moved LIBMCRYPT since it was installed. In the latter case, you
*** may want to edit the libmcrypt-config script: no
configure: error: *** libmcrypt was not found
木有找到libmcrypt依赖库,呵呵,这会难倒我?在mcrypt目录下执行

./configure -h
查看帮助,找到一条

看见里面的--with-libmcrypt-profix了木有,指向libmcrypt的安装路径(到包含bin,lib等文件夹的那一层)

./configure --with-libmcrypt-profix=/usr/local/libmcrypt
以上代码编译之(编译不出来我吃翔!!!)



大家好,其实翔挺好吃的,玉米味,卡蹦脆。

不胡扯,继续

还是报错了,如下

*** Could not run libmcrypt test program, checking why…
*** The test program compiled, but did not run. This usually means
*** that the run-time linker is not finding LIBMCRYPT or finding the wrong
*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you’ll need to set your
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
*** to the installed location   Also, make sure you have run ldconfig if that
*** is required on your system
***
*** If you have an old version installed, it is best to remove it, although
*** you may also be able to get things to work by modifying LD_LIBRARY_PATH
***
configure: error: *** libmcrypt was not found


错误很简单,懂点英文都没问题,少环境变量嘛, LD_LIBRARY_PATH,这里是library_path,注意啊,别写安装目录,是安装目录下的lib目录!!!我在这卡了好久,太粗心。


添加环境变量有多种方式,最简单的

export LD_LIBRARY_PATH=<span style="color:#ff6666;">/usr/local/lib</span>: LD_LIBRARY_PATH

橙色部分是你自己的lib路径。

这样的办法把shell关闭就木了,我用的方法是在用户主目录下的.bash_profile(本用户有效)中添加


当然如果你愿意可以在/etc/profile(全局有效)文件中添加以上代码,效果是一样的。


然后继续执行

./configure --with-libmcrypt-profix=/usr/local/libmcrypt
应该就是木有神马问题了。
对了,在我编译半天出不来的时候执行过一个命令:
ln -s   /usr/local/libmcrypt/bin/libmcrypt-config   /usr/bin/libmcrypt-config

在我看来这个命令把config文件复制到了usr/bin 下,看了以下./configure的源码,查找 /usr/bin 的确有挺多地方的,但shell编程水平太渣,大多看不懂。

在大家绝望的时候可以试着执行上面这段代码,第一个参数是自己安装的libmcrypt路径。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值