我又来找虐了,在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
添加环境变量有多种方式,最简单的
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路径。