Solve the problem of compiling PHP that cannot find LIBC-CLIENT.A

Source: Internet
Author: User
Tags fpm imap mkdir openssl php compiler


Recent PHP leaks, old High is also upgrading the PHP version, and add some support, but encountered this problem is very painful

Configure:error:Cannot Find IMAP library (LIBC-CLIENT.A). Please check your c-client installation.
Online Search a variety of tutorials, all kinds of CP is useless, simply let us compile it!

I. Installing the DEVEL library

Yum Install Pam-devel libc-client libc-client-devel-y

If you use Yum to install libc-client, then the path in the later compilation parameter--with-imap=/usr/local/php-imap should be deleted, that is,--with-imap.

If this is not yet resolved, then you need to manually compile the imap2007f!

Ii. Manual compilation of imap2007f

Script taken from http://forum.directadmin.com/showthread.php?t=45434

Running the following script under the/USR/SRC directory will generate an IMAP-required library in the/usr/local/php-imap directory

#!/bin/sh
# Script for Php-imap installation. 0.1b
# Written by Martynas Bendorius (Smtalk)

cwd= ' pwd '
os= ' uname '

#Is it a 64-bit OS?
B64=0

B64count= ' Uname-m | Grep-c 64 '
If ["$B 64COUNT"-eq 1]; Then
B64=1
Ld_library_path=/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib
Export Ld_library_path
Fi

if [!-e/usr/include/krb5.h] && [-e/etc/redhat-release]; Then
echo "Installing Krb5-devel"
Yum-y Install Krb5-devel
Fi

version=2007f
Protocol=ftp
Url= "${protocol}://ftp.cac.washington.edu/imap/imap-${version}.tar. Z
Filename=imap-${version}
Tarball=${filename}.tar. Z

echo "Downloading ${tarball} ..."
Wget-o ${tarball} ${url}
Tar Xzf ${tarball}
CD ${filename}

echo "Installing ${filename} ..."

If [${os} = "FreeBSD"]; then
    if [${b64}-eq 0]; then
       ;  make BSF
    else
        make BSF extracflags=-fpic
    fi
Else
    perl-pi-e ' s#ssldir=/usr/local/ssl#ssldir=/etc/pki/tls# ' Src/osdep/unix/makefile
    perl-pi-e ' s#sslinclude=\$\ (ssldir\)/include#sslinclude=/usr/ include/openssl# ' src/osdep/unix/makefile
    perl-pi-e ' s#ssllib=\$\ (ssldir\)/lib#ssllib=/usr/ lib/openssl# ' Src/osdep/unix/makefile
    if [${b64}-eq 0]; then
         make SLX
    else
        make SLX Extracflags=-fpic
    fi
Fi

echo "Copying Files To/usr/local/php-imap"
Mkdir-p/usr/local/php-imap/include
Mkdir-p/usr/local/php-imap/lib
Chmod-r 077/usr/local/php-imap
Cp-f c-client/*.h/usr/local/php-imap/include/
Cp-f c-client/*.c/usr/local/php-imap/lib/
Cp-f C-CLIENT/C-CLIENT.A/USR/LOCAL/PHP-IMAP/LIB/LIBC-CLIENT.A
Cd..
RM-RF ${filename}

If [-D/USR/LIB/X86_64-LINUX-GNU] && [!-d/usr/kerberos/lib]; Then
Mkdir-p/usr/kerberos
Ln-s/usr/lib/x86_64-linux-gnu/usr/kerberos/lib
Fi


Exit 0;

Iii. Start compiling

Here are the parameters to compile PHP, if there is a problem, please refer to the compiler PHP5.6 and PHP compiler error resolution.

./configure--prefix=/usr/local/php--with-pdo-pgsql--with-zlib-dir--with-freetype-dir--enable-mbstring- WITH-LIBXML-DIR=/USR--enable-soap--enable-calendar--with-curl--with-mcrypt--with-zlib- Disable-rpath--enable-inline-optimization--with-bz2--with-zlib--enable-sockets--enable-sysvsem --enable-pcntl--enable-mbregex--enable-exif--enable-bcmath--with-mhash--enable-zip-- With-mysql--with-pdo-mysql--with-mysqli--with-jpeg-dir=/usr--with-png-dir=/usr--enable-gd-native-ttf-- With-openssl--enable-ftp--with-imap=/usr/local/php-imap--with-imap-ssl--with-kerberos--with-gettext-- With-xmlrpc--with-xsl--enable-opcache--enable-fpm--with-fpm-user=www--with-fpm-group=www
Iv. Other issues

In this compilation, old Gao encountered a few strange things

Set--enable-opcache=no

Configure:error:Don ' t know how to define struct flock on this system, set--enable-opcache=no
This issue is also a link to the library file

Solve:

Echo/usr/local/lib >/etc/ld.so.conf.d/local.conf
Ldconfig-v
Let the compiled PHP support memcache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.