وبلاگ سایت

رفع خطای IMAP needs to be compiled

برای برطرف کردن خطای IMAP needs to be compiled into PHP for this to function

مراحل زیر را در دایرکت ادمین طی کنید

۱)ابتدا پیش نیاز های زیر باید نصب شود

Debian:
apt-get install libc-client-dev

CentOS, fedora
yum install libc-client libc-client-devel

 CentOS 64-bit
yum install krb5-appl-clients.x86_64
yum install krb5-appl-servers.x86_64

۱) سپس باید محل فایل کانفیک php را پیدا کنیم

به مسیر زیر بروید و سپس خط بعدی را اجرا کنید

cd /usr/local/directadmin/custombuild/
./build used_configs

خروجی محل نصب تنظیمات php را نشان می دهد

Apache configuration file: /usr/local/directadmin/custombuild/configure/ap2/configure.apache
suPHP configuration file: /usr/local/directadmin/custombuild/configure/suphp/configure.suphp
PHP5 configuration file: /usr/local/directadmin/custombuild/configure/suphp/configure.php5
ProFTPD configuration file: /usr/local/directadmin/custombuild/configure/proftpd/configure.proftpd

مثلا اگر suphp  نصب باشد مسیر زیر خواهد بود

/usr/local/directadmin/custombuild/configure/suphp/configure.php5

حال آن را با ویرایشگر باز می کنیم ویرایشگر محبوب من nano است

nano  /usr/local/directadmin/custombuild/configure/suphp/configure.php5

در خط آخر آن عبارت زیر را اضافه کنید

--with-imap=/usr/lib/dovecot/imap \
--with-imap-ssl

دقت کنید که فقط اخرین خط نباید \ داشته باشد برای قبلی \ قرار دهید

حال باید php را دوباره بسازیم

./build php n

تمام

////////////////////////////////////

اگر روش بالا برای شما جواب نداد روش مهم زیر را طی کنید

This documentation deals with building php with imap support on directadmin servers:

Section 1:This installation documentation is based on RHEL or Centos based server.

Section 2: Installing manually on centos 6(64 bit) servers (deals with Cannot find imap library (libc-client.a) )

Section3 : Installation using automated script on CentOS and FreeBSD servers

You can try any section .For FreeBSD users you may need to use section 3.

SECTION 1:

This section deals with building PHP with imap support for CentOS+Directadmin server.

# yum install libc-client libc-client-devel

(C-client is a common API for accessing mailboxes. It is used internally by the popular PINE mail reader, the University of Washington’s IMAP server and PHP.)

# yum install krb5-devel krb5-libs

(Kerberos is a network authentication system. The krb5-devel package contains the header files and libraries needed for compiling Kerberos 5 programs and The krb5-libs package contains the shared libraries needed by Kerberos 5)

Now edit the file:

/usr/local/directadmin/custombuild/configure/ap2/configure.php5 and add the following two lines.

–with-imap \
–with-imap-ssl

With suphp installed add the following lines in /usr/local/directadmin/custombuild/configure/suphp/configure.php5 this with quotes :

“- With-imap-ssl \”
“- with-imap \”

Difference between following files:

/usr/local/directadmin/custombuild/configure/ap2/configure.php5 is used for PHP5-CLI (mod_php)
/usr/local/directadmin/custombuild/configure/suphp/configure.php5 is used for PHP5-CGI (mod_suphp)

Now build the php using the following

# ./build php 5

After compilation completes sucessfully.You may please check whether imap extension is enabled in php.You can check it by using command:

# php -m | grep imap
NOTE:If you are having 64 bit server make sure to enable a soft link as follows:

# ln -s /usr/lib64/libc-client.a /usr/lib/libc-client.a

SECTION 2:

configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.

If you centOS installation is 6 then you may get these errors:

I installed the libc-client and libc-client-devel packages, but unlike the CentOS 5.x libc-client-devel package, the same rpm in CentOS 6 does not have the libc-client.a static library.

How to overcome this issue:

problem: on centos, the libc-client package is compiled with a low “FD_SETSIZE” limit (I assume 256). when adding imap support to php, compiling against the default libc-client RPMs, this will cause Apache to segfault if Apache has over 256 open file descriptors. All active apache logs count against this limit so its easy to hit on a shared hosting server.
solution: download latest imap c-client and compile from scratch:

Download and extract

Code:

cd /usr/local/src/
wget http://files.directadmin.com/services/da_imap-2007e.tar.gz
tar xvf da_imap-2007e.tar.gz
cd imap-2007e
edit source files

edit src/osdep/unix/os_art.c and src/osdep/unix/os_sv2.c in an editor,

find this:

Code:
#define FD_SETSIZE 256
change it to:

Code:
#define FD_SETSIZE 32768

OR Replace using command:

/bin/sed -i ‘s/FD_SETSIZE\t256/FD_SETSIZE\t32768/’ src/osdep/unix/os_art.c

/bin/sed -i ‘s/FD_SETSIZE\t256/FD_SETSIZE\t32768/’ src/osdep/unix/os_sv2.c

Openssl symlink

you should already have openssl and openssl-dev packages installed, but no /usr/local/ssl directory. run:

Code:
ln -s /usr/lib64/openssl/engines/ /usr/local/ssl
ln -s /usr/include/ /usr/local/ssl/include

compile imap c-client

Code:

For 64-Bit system:

# make slx

For 32-Bit system

# make slx EXTRACFLAGS=-fPIC
Make directory lib and include put files as mentioned below:

Code:

mkdir /usr/local/php-imap
mkdir /usr/local/php-imap/lib
mkdir /usr/local/php-imap/include
cd /usr/local/php-imap/
cp /usr/local/src/imap-2007e/c-client/*.c lib/
cp /usr/local/src/imap-2007e/c-client/*.h include/
cp /usr/local/src/imap-2007e/c-client/c-client.a lib/libc-client.a

recompile php

Code:

cd /usr/local/directadmin/custombuild
if you don’t already have a custom configure.php;

Code:

mkdir -p custom/ap2
cp configure/ap2/configure.php5 custom/ap2
cp -rv configure/suphp custom/

add these lines to your custom/ap2/configure.php5 file and custom/suphp/configure.php5:

Code:
–with-imap=/usr/local/php-imap \
–with-imap-ssl \

now run

./build php n

Refer : http://www.directadmin.com/imap.txt

 

 SECTION 3:

USING AUTOMATIC SCRIPT FOR INSTALLING IMAP ON CentOS / FeeBSD Servers:

# cd /usr/local/src/
# wget http://thedirectadmin.com/files/imap-php.sh
# sh imap-php.sh

Run the script, then add the following lines to:

/usr/local/directadmin/custombuild/configure/ap2/configure.php5

Code:
–with-imap=/usr/local/php-imap \
–with-imap-ssl \

and

/usr/local/directadmin/custombuild/configure/suphp/configure.php5

code:
“- With-imap-ssl \”
“- with-imap=/usr/local/php-imap \”

And rebuild PHP.

./build php 5

محمد علی پور فتحکوهیرفع خطای IMAP needs to be compiled
Share this post

2 comments

Join the conversation
  • منصوری - دسامبر 26, 2013 reply

    سلام
    واقعا عالی بوذ

    محمد علی پور فتحکوهی - دسامبر 28, 2013 reply

    ممنون

Join the conversation

در حال بارگیری کپچا پلاس ...