日期:2014-05-17  浏览次数:20502 次

php5.4.13在ubuntu12.04上的配置

一、到官网下载最新的php5.4.13.tar.gz

在这里弱弱的提醒一句---自PHP5.3以后都内置了php-fpm,不需要另行安装php-fpm,即php-cgi管理程序

二、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

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-curl --with-pear --with-gd --with-jpeg-dir --with-png-dir --with-zlib --with-xpm-dir --with-freetype-dir --with-t1lib --with-mcrypt --with-mhash --with-mysql --with-mysqli --enable-pdo --with-pdo-mysql --with-openssl --with-xmlrpc --with-xsl --with-gettext --with-fpm-user=www-data --with-fpm-group=www-data --enable-fpm --enable-exif --enable-wddx --enable-zip --enable-bcmath -with-bz2 --enable-calendar --enable-ftp --enable-mbstring --enable-soap --enable-sockets --enable-shmop --enable-dba --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-debug --enable-maintainer-zts --enable-embed

?

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