PHP 5.3.2
libmcrypt-2.5.8
mhash-0.9.9.9
mcrypt-2.6.8
前两个正常安装 configure, make, make install都没有问题,最后安装mcrypt时,出现如下错误:
*** 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
网上有文章介绍是lib路径的问题,方法是:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
我试过不行。看了libmcrypt的路径是/usr/local/libmcrypt ,把/usr/local/libmcrypt/lib 也加到LD_LIBRARY_PATH 中,问题解决:
export LD_LIBRARY_PATH=/usr/local/libmcrypt/lib
./configure
或直接运行
LD_LIBRARY_PATH=/usr/local/libmcrypt/lib ./configure
然后出现第二个问题,configure时报错:
configure: error: "You need at least libmhash 0.8.15 to compile this program. http://mhash.sf.net/ "
NND,没搞定!把mhash的lib路径加到LD_LIBRARY_PATH也不行。
直接编译PHP了
出了几个小问题,一个是提示要重新安装mysql( reinstall mysql instrubution),这个是因为找不到mysql_config文件,改一下位置即可。
另一个是--with-pdo-mysql的路径不对,指到对应的位置即可。
Mysql是用rpm安装,还需要下载dev的rpm包,才能有相应的头文件。
这里是参考文章:
http://hi.baidu.com/yunluolu/blog/item/1c90638d4d840a1eb21bbaf0.html
php编译命令:
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache/bin/apxs --with-freetype-dir=/usr/local/freetype --with-mysql=/usr/local/mysql --with-zlib --with-libxml-dir=/usr/local/libxml2 --enable-shared --with-curl=/usr/local/curl --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg-8a --with-mcrypt=/usr/local/libmcrypt --with-mhash=/usr/local/mhash --enable-mbstring=all --enable-mbregex --with-mysqli=/usr/bin/mysql_config --with-pdo-mysql=/usr/bin/mysql
参考文章:
Linux下Apache,Mysql,PHP安装配置(magento1.3.24运行环境)
http://www.it513.com/archives/13
在FreeBSD下安装mysql+apache+php [原创]
http://www.chinaunix.net/jh/13/720474.html
ubuntu下安装php
http://hi.baidu.com/yunluolu/blog/item/1c90638d4d840a1eb21bbaf0.html
nginx + php(fastcgi)搭建高性能web服务器
http://www.ai77.org/archives/489
为php编译mcrypt函数
http://blog.5ilinux.com/archives/2006/02/phpmcrypt.html