linux安装php遇到的问题

第一个问题:configure: error: libjpeg.(a|so) not found

很多人都纳闷儿了,我都安装了的,为什么就找不到呢?找不到其实就应试想到它的搜索位置里面是没有的,要不然才不会说not found

原因是我们大部分一些软件只要rpm -qa | grep ***

这时下面就有两个重复的的软件

[root@test php-5.2.13]# rpm -qa | grep jpeg

libjpeg-6b-33

libjpeg-6b-33

libjpeg-devel-6b-33

32位和64位的都装了。你可以强制删除两个包,再重装64位的包。

rpm --allmatches --nodeps

这种方法真是损系统又损你.有时候强制执行的东西也会随便把lib中的一些包给强制删了.所以我不建议这么做,重复就让它重复吧,没关系的!

要解决问题就是它没找到,我安装了的,那我得去找找看它到底是放那里去了.

[root@test php-5.2.13]# updatedb

[root@test php-5.2.13]# locate libjpeg.so

/usr/lib64/libjpeg.so.62

/usr/lib64/libjpeg.so.62.0.0

/usr/lib64/libjpeg.so

/usr/lib/libjpeg.so

[root@test php-5.2.13]# locate libjpeg.a

/usr/lib64/libjpeg.a

/data0/software/jpeg-6b/libjpeg.a

[root@test php-5.2.13]#

我们在编译的时候经常看到一个库的文件,一般就是以*.a,*.so等名字的,尝试的搜索搜索,不行就模糊搜索!

通过上面的搜索其实就知道一些原因了,configure一般的搜索编译路径为/usr/lib/下,因为php默认就在/usr/lib/下找相关库文件,而x64机器上是在:/usr/lib64.这时你就可以直接把需要的库文件从/usr/lib64中拷贝到/usr/lib/中去就可以了.

那么记得要在configure前执行如下的命令:

cp -frp /usr/lib64/libjpeg.* /usr/lib/

第二个问题:configure: error: libjpng.(a|so) not found

cp -frp /usr/lib64/libpng* /usr/lib/ //和上面方法一样

第三个问题:configure: error: Cannot find ldap libraries in /usr/lib.

cp -frp /usr/lib64/libldap* /usr/lib/ //和上面方法一样

另外附一些常见的configure错误列表供参考:

第一个 configure: error: No curses/termcap library found

解决方法:

redhat and centos运行:yum -y install ncurses-devel

debian and ubuntu运行: apt-get install libncurses5-dev

第二个 configure: error: xml2-config not found

yum -y install libxml2-devel

debian:apt-get install libxml2-dev

第三个 configure: error: Cannot find OpenSSL's

yum -y install openssl-devel

第四个 configure: error: libjpeg.(a|so) not found

yum -y install gd

yum -y install gd-devel

debian:apt-get install libjpeg-dev

第五个 configure: error: libpng.(a|so) not found.

apt-get install libpng12-dev

第六个 configure: error: cannot find output from lex; giving up

yum -y install flex

第七个 configure: error: mod_deflate has been requested but can not be built due to prerequisite failures

yum -y install zlib-devel openssl-devel

debian:apt-get install zlib1g-dev

第八个 configure: error: libXpm.(a|so) not found.

apt-get install libxpm-dev

第九个 configure: error: freetype.h not found.

apt-get install libfreetype6-dev

第十个 configure: error: No recognized SSL/TLS toolkit detected

apt-get install libssl-dev

yum install libssl-dev

第十一个 Configure: error: xml2-config not found. Please check your libxml2 installation.

yum install libxml2 libxml2-devel (For Redhat & Fedora)

aptitude install libxml2-dev (For ubuntu)

第十二个 configure: error: Cannot find OpenSSL’s

yum install openssl openssl-devel

第十三个 Configure: error: Please reinstall the BZip2 distribution

yum install bzip2 bzip2-devel

第十四个 Configure: error: Please reinstall the libcurl distribution -easy.h should be in /include/curl/

yum install curl curl-devel (For Redhat & Fedora)

install libcurl4-gnutls-dev (For Ubuntu)

第十五个 Configure: error: libjpeg.(also) not found.

yum -y install gd

yum -y install gd-devel

yum install libjpeg libjpeg-devel

第十六个 Configure: error: libpng.(also) not found.

yum install libpng libpng-devel

apt-get install libpng12-dev

第十七个 Configure: error: freetype.h not found.

yum install freetype-devel

第十八个 Configure: error: Unable to locate gmp.h

yum install gmp-devel

第十九个 Configure: error: Cannot find MySQL header files under /usr.

Note that the MySQL client library is not bundled anymore!

解决方法:

yum install mysql-devel (For Redhat & Fedora)

apt-get install libmysql++-dev (For Ubuntu)

第二十个 Configure: error: Please reinstall the ncurses distribution

yum install ncurses ncurses-devel

第二十一个 Checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!

方法 :

yum install unixODBC-devel

第二十二个 Configure: error: Cannot find pspell

yum install pspell-devel

第二十三个 configure: error: mcrypt.h not found. Please reinstall libmcrypt.

yum install libmcrypt libmcrypt-devel (For Redhat & Fedora)

apt-get install libmcrypt-dev

第二十四个 Configure: error: snmp.h not found. Check your SNMP installation.

yum install net-snmp net-snmp-devel

第二十五个 开启LDAP服务还需要

yum -y install openldap-devel openldap-servers openldap-clients

第二十六个 configure: error: No curses/termcap library found

yum -y install ncurses-devel (for redhat)

apt-get install libncurses5-dev(for debian)

第二十七个 configure: error: cannot find output from lex; giving up

yum -y install flex

第二十八个 configure: error: mod_deflate has been requested but can not be built due to prerequisite failures

yum -y install zlib-devel openssl-devel

debian:apt-get install zlib1g-dev

第二十九个 configure: error: libXpm.(a|so) not found.

apt-get install libxpm-dev

yum install libXpm