HOWTO: PHP with IMAP support for CentOS6

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,580
Thanks, you was right. dos2unix fixed it. Running it now ...
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,580
@smtalk, after using your script to install, and then change the php configuration file and then recompile php, it seems to work but I get this warning when recompiling php:

Code:
/usr/local/php-imap/lib/libc-client.a(osdep.o): In function `ssl_onceonlyinit':
/root/imap-2007f/c-client/osdep.c:302: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
Do you have a comment about that?
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
9,112
Location
LT, EU
That's normal. tmpnam is used in imap-2007f/c-client/osdep.c, that's why you get a warning. You may change it to mkstemp if you'd like to, however, UW imap is created by a professional coder, so I see no reasons not to trust the code, tmpnam is completely safe in the hands of a good programmer :)
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,580
Thank you for the confirmation, smtalk! Also when testing it seems to work fine! :) However one last thing I am worried about when reading http://thedirectadmin.com/?p=15

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.
and

Code:
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
Would you think this need to be changed? My servers are used for shared hosting clients.
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,580
On my test server I did install libc-client and libc-client-devel with yum before running smtalk script. But is it really needed to install libc-client and libc-client-devel when using smtalk script?

Edit: I tested on a different server without installing libc-client and libc-client-devel, and it also works. So it seems those are not needed?
 
Last edited:

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,580
I am trying to test if php imap works, it looks good in phpinfo file. But I am trying this script: http://www.inkplant.com/code/imap-mailbox-test.php

But I only get this error:

Code:
Error opening mailbox: [CLOSED] IMAP connection broken (server response)
So, is it something wrong with my imap php, or is it my test that is broken? Any other way to test if imap in php works?
 

SeLLeRoNe

Super Moderator
Joined
Oct 9, 2004
Messages
6,794
Location
A Coruña, Spain
Also, the command to use are into the script, just manual use them... or tell me you OS and i just copy/paste them to you from the script...

Regards
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,580
I have already installed using smtalk script, and everything works correct now. Please note it is not needed to install libc-client and libc-client-devel, it works without them.

My os is centos 6.4 64bit
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,580
After installing imap with smtalk script, wich by the way seem to work very well, I get these warnings in Logwatch:

Code:
 --------------------- Kernel Begin ------------------------ 
 
 
 WARNING:  Segmentation Faults in these executables
    conftest :  1 Time(s)
 
 ---------------------- Kernel End -------------------------
I don't think it is anything to worry about, but maybe someone has a different opinion about that?
 

colt714

New member
Joined
Dec 18, 2013
Messages
2
Php-imap

I have all commands that Maniak placed in his post on 1-8-2013 and did not received any errors.

But if we want to use it for a 'Process Bounced Emails' it states that the server still does not have the required PHP-IMAP modules installed.

I am quite new in this and running out of options.

Can anybody assist me in checking what I am doing wrong?
 

Maniak

Verified User
Joined
Aug 25, 2004
Messages
220
Location
Switzerland
I have all commands that Maniak placed in his post on 1-8-2013 and did not received any errors.

But if we want to use it for a 'Process Bounced Emails' it states that the server still does not have the required PHP-IMAP modules installed.

I am quite new in this and running out of options.

Can anybody assist me in checking what I am doing wrong?

Which PHP instance are you calling, what is the exact path?
What happens when you call that path with the "-m" option?
 

colt714

New member
Joined
Dec 18, 2013
Messages
2
Which PHP instance are you calling, what is the exact path?
What happens when you call that path with the "-m" option?

Hallo Maniak,
Thank you for wanting to assist me.
As I said: I am quite new in this so forgive me if I can not give you the requested answers directly.

We want to work with a newsletter system that has a bounce.php cron job (Interspire Email Marketer).
If we want to run it, it gives the error: "IMAP module not found for PHP CLI" (Error Source "Internal")

To make sure I do not make big errors in our server it would be nice if you could check this for yourself.
If needed I can send you privately some login details, just let me know what you need.
 

dmacleo

Verified User
Joined
Jun 21, 2012
Messages
644
trying to do this now and I get this error:
--with-imap=/usr/local/php-imap: No such file or directory
using the 2007f version I get same error
--with-imap-ssl=/usr/local/imap-2007f: No such file or directory
somehow the script is not creating the directories ?
am I missing something?
 

dmacleo

Verified User
Joined
Jun 21, 2012
Messages
644
trying to do this now and I get this error:

using the 2007f version I get same error


somehow the script is not creating the directories ?
am I missing something?
yeah I was missing something, a trailing / on line before I entered these 2 lines.
 

r3chn3r

Verified User
Joined
Jan 13, 2013
Messages
137
Please forgive the dumb question..

But which configure.php file do I use? Not knowing anything, I did a search.:

[root@direct ~]# find / -name "configure.php"
[root@direct ~]# find / -name "configure.php5"
/usr/local/directadmin/custombuild/configure/ap1/configure.php5
/usr/local/directadmin/custombuild/configure/ap2/configure.php5
/usr/local/directadmin/custombuild/configure/suphp/configure.php5

Then I found three configure.php5 files..
Could someone clarify that last step?
 

r3chn3r

Verified User
Joined
Jan 13, 2013
Messages
137
I suggest you to follow this guide: http://www.directadmin.com/imap.txt
Be careful when adding modules to PHP.
Thank you,

The closest I got was by following the instructions directly from the directadmin folks here:
http://www.directadmin.com/imap.txt

Half way down, you''ll see the error lucky folks running centos 64bit, like me, will see:
"Cannot find imap library (libc-client.a). Please check your c-client installation."

I can't seem to resolve that issue. Reloaded DA like 10 times from scratch trying..
 

Maniak

Verified User
Joined
Aug 25, 2004
Messages
220
Location
Switzerland
Half way down, you''ll see the error lucky folks running centos 64bit, like me, will see:
"Cannot find imap library (libc-client.a). Please check your c-client installation."
Try running this:

yum install -y pam-devel libc-client libc-client-devel krb5-appl-clients.x86_64 krb5-appl-servers.x86_64
ln -s /usr/lib64/libc-client.a /usr/lib/libc-client.a

and run again the full procedure over.
 
Last edited:

r3chn3r

Verified User
Joined
Jan 13, 2013
Messages
137
"Try running this: yum install pam-devel"

That worked flawlessly!!

THANK YOU!
 
Last edited:
Top