[Solved] Process Bounces using Amazon Remote DB

I have been using phplist for long time. After migrated it to a new server (Linux-Ubuntu 14.04 + nginx) everything has been working fine (auto response, newsletter, cron, subscribing processes but not the process of bounces.

I am sure that the pop3 bounce configuration is correct because I am able to process the bounces from the old server using same conf file, same DB and same remote mail server .

The new server behavior is: after click on process bounce link, the browser stay on the php manage bounce page (not present a new page with a text input filed as should be), and keep an open http connection for a while until finish it presenting a new blank page. Nothing else.

The event log shown that only old bounce are reprocessed.
The server has php 5.6.10 and the IMAP module is active.

I am not sure where start the trouble shooting. So far I didn’t find where is the problem.
Any idea?

PD: Looking to the mail server log files, looks like phplist is requesting the connection and it is able to login. Then logout.
The blank page presented after the click of the process bounce link has an 504 GATEWAY_TIMEOUT error in its header and took over 60 second waiting for the TTFB.

An update of my trouble shooting.

I temporarily replaced the processbounce.php file content with this:

<?php $server ="servername"; $port ="993/imap/ssl/novalidate-cert/notls"; $user ="userEmail"; $password ="password"; $mbox = imap_open('{'.$server.':'.$port.'}INBOX', $user, $password); echo "


\n"; $folders = imap_listmailbox($mbox, "{".$server.":".$port."}", "*"); if ($folders == false) { echo "Call failed
\n"; } else { foreach ($folders as $val) { echo $val . "
\n"; } }

echo “

Headers in INBOX

$headers = imap_headers($mbox);

if ($headers == false) {
echo “Call failed
} else {
foreach ($headers as $val) {
echo $val . “


I run the process bounces doing click on the link and I get the results:

{servername:993/imap/ssl/novalidate-cert/notls}INBOX.Deleted Items

Headers in INBOX

1)24-Mar-2016 =?UTF-8?Q?AprendeFot Lists subscription (2379 chars)
2)24-Mar-2016 =?UTF-8?Q?AprendeFot Lists subscription (2379 chars)
3)24-Mar-2016 =?UTF-8?Q?AprendeFot Lists subscription (2379 chars)

This test eliminated that the issue is a server comunication or configuration.
The question is: why the processbounces.php fail to give a response if it is using same imap_open function and same parameter?

Well this case can be closed. Finally I found the problem. After add section to section to my temporary processbounce.php file I found that the while-case loop starting at line491 to line 640 was taking too long time to be executed passing the server timeout configuration.
Why? I suspect that being the phplist DB a remote one (phplist app runs in n Amazon instance server with an attached RDS database) is taking more time than before that it was located locally.

The solution for other running phplist on a Nginx server with remote DB:
Change at the php.ini configuration file the following:
max_execution_time = 300
default_socket_timeout = 300
mysql.connect_timeout = 300
max_input_time = 300

300 it what I used, it may be the seconds you want.

At your Nginx.conf and at the server file locate at sites-available folder change:
keepalive = 300
fastcgi_read_timeout 300 if you are using Fastcgi.

Hope this help others!