一、到官网下载最新的php5.4.13.tar.gz
二、tar zxvf php5.4.13.tar.gz
三、cd php5.4.13
四、./buildconf --force如果报以下错误You need autoconf version 2.59 or higher
??? 则执行先卸载原先的autoconf:
apt-get --purge remove autoconf
?? 然后
apt-get autoremove autoconf
?? 然后直接安装
apt-get install autoconf
五、开始编译安装配置PHP5.4.13
?
make && make install
?
当中遇到的错误和解决方法如下:
?
1) Configure: error: xml2-config not found. Please check your libxml2 installation.
Solutions :
# aptitude install libxml2-dev
2) Checking for pkg-config… /usr/bin/pkg-config
configure: error: Cannot find OpenSSL’s <evp.h>?or?<hmac.h>
Solutions :
?
sudo apt-get install openssl-dev
?
sudo apt-get install libcurl3-openssl-dev
?
?
?
3) Configure: error: Please reinstall the BZip2 distribution
Solutions :
? apt-get install libbz2-dev
4) Configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
Solutions :
apt-get install curl
apt-get install libcurl3
apt-get install libcurl4-gnutls-dev(For Ubuntu)
5) Configure: error: libjpeg.(also) not found.
Solutions :
?apt-get install libjpeg-dev
6) Configure: error: libpng.(also) not found.
Solutions :
apt-get install libpng-dev
7) Configure: error: freetype.h not found.
Solutions :
8) Configure: error: Unable to locate gmp.h
Solutions :
yum install gmp-devel
9) Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
Solutions :
yum install mysql-devel (For Redhat & Fedora)
# apt-get install libmysql++-dev (For Ubuntu)
10) Configure: error: Please reinstall the ncurses distribution
Solutions :
yum install ncurses ncurses-devel
11) Checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!
Solutions :
yum install unixODBC-devel
12) Configure: error: Cannot find pspell
Solutions :
yum install pspell-devel
13) configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Solutions :
yum i