1. First of all, we need install php dependency library, they are:
(1) jpeg library: jpegsrc.v9.tar.gz
(2) png library: libpng-1.6.6.tar.gz
(3) freetype: freetype-2.5.0.1.tar.gz
(4) mcrypt: libmcrypt-2.5.8.tar.gz
mcrypt-2.6.8.tar.gz
(5) mhash-0.9.9.9.tar.gz
1. libxml2-(version).tar.gz ---> http://ftp.gnome.org/pub/GNOME/sources/libxm2
2. curl-(version).tar.gz ---> http://curl.haxx.se/download
3. gd-(version).tar.gz ---> http://libgd.bitbucket.org/
4. freetype-(version).tar.gz ---> http://sourceforge.net/projects/freetype
5. jpegsrc.v6b.tar.gz ---> http://ijg.org/files/jpegsrc.v6b.tar.gz
6. libpng-(version).tar.gz ---> http://www.libpng.org/pub/png/libpng.html
7. zlib-1.2.3.tar.gz ---> http://www.zlib.net
Now i have both libmcrypt and mcrypt compiled from source.I know it can be also installed over yum, but that is not always reliable and i more prefer to have native installs.Anyway solution to this problem is to simply add location of libmcrypt.so.4 file.My libmcrypt.so.4 was located on /usr/local/lib/ ,which i found it by command locate libmcrypt.so.4.(run command updatedb before for every case)Then go to directory /etc/ld.so.conf.d/ ,and there you will see conf files.You can either create new conf file called mcrypt.conf or simply add /usr/local/lib/ (or whatever is file libmcrypt.so.4 located)to new line,save file and
then run ldconfig.And it will work then.
then run ldconfig.And it will work then.
注:安装libxml2的时候有碰到一个编译无法通过的错误,
{
{
usr/include/bits/fcntl2.h:51: 错误: 调用‘__open_missing_mode’,声明有错误属性:open with O_CREAT in second argument needs 3 arguments
此处是因为gcc-4.3对语法检查严格的原因,我们找到出错的nanohttp.c文件,将出错的1588行的
int fd = open(fn.c_str(), O_WRONLY | O_CREAT | O_TRUNC) 改为
int fd = open(fn.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0777)即可
int fd = open(fn.c_str(), O_WRONLY | O_CREAT | O_TRUNC) 改为
int fd = open(fn.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0777)即可
}
2. get php source: php-5.5.4.tar.bz2
3. unzip all the lib files to /usr/local/lib, and then configure and install them.
(1) libipeg
wget "http://www.ijg.org/files/jpegsrc.v9.tar.gz"
tar zxvf /tmp/jpegsrc.v9.tar.gz -C /usr/local/lib
cd /usr/local/lib/jpeg-9/
./configure --prefix=/usr/local/lib --enable-shared --enable-static --prefix=/usr/local/lib
make && make install
(2) libpng
wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.6.tar.gz
tar zxvf /tmp/libpng-1.6.6.tar.gz -C /usr/local/lib
cd /usr/local/lib/libpng-1.6.6/
./configure --prefix=/usr/local/lib
make && make install
Note: if you get an error message saying: "configure: error: zlib not installed", that indicates that you may need to install zlib1g-dev, use:
apt-get install zlib1g-dev
(3) freetype
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.0.1.tar.gz
tar zxvf /tmp/freetype-2.5.0.1.tar.gz -C /usr/local/lib
cd /usr/local/lib/freetype-2.5.0.1/make
./configure --prefix=/usr/local/lib
make && make install