php安裝報錯centos7
PHP安裝的幾個問題
依賴包彙總
yum -y install pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel openldap-servers openldap-client nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel
編譯
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mysqlnd-compression-support --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-intl --with-mcrypt --with-libmbfl --enable-ftp --with-gd --enable-gd-jis-conv --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --with-pear --enable-maintainer-zts --with-ldap=shared --without-gdbm --with-mcrypt --enable-gd-native-ttf
報錯
configure: error: Cannot find ldap.h
configure: error: Cannot find ldap libraries in /usr/lib 首先檢視:# rpm -qa openldap* openldap-devel-2.4.40-8.el7.x86_64 openldap-clients-2.4.40-8.el7.x86_64 openldap-2.4.40-8.el7.x86_64 openldap-servers-2.4.40-8.el7.x86_64 openldap四個包缺少的則安裝上去 yum install openldap openldap-devel openldap-servers openldap-client 然後執行: cp -frp /usr/lib64/libldap* /usr/lib/
(2) checking for cURL 7.10.5 or greater… configure: error: cURL version 7.10.5 or later is required to compile php with cURL support 首先檢視 rpm -qa libcurl* libcurl-7.29.0-25.el7.centos.x86_64 發現少了libcurl-dev 安裝yum install libcurl-devel
PS:如果還是不行,請參考https://yq.aliyun.com/ask/24123 https://curl.haxx.se/download/ 下載並重新編譯curl 當然,如果本身bin/curl-config --version 顯示版本號沒問題,就另當別論。