I'm using Zend framework provided IMAP classes to access gmail messages over imap. I access the message headers of all the messages in the inbox one by one and index them locally. The script works fine for inboxes with messages less than 10000. For larger inboxes the script looses the connection, probably a timeout.
Here is the stack trace:
Exception Message: cannot read - connection closed?
trace:
#0 /home/dev/trunk/Zend/Mail/Protocol/Imap.php(168): Zend_Mail_Protocol_Imap->_nextLine() #1 /home/dev/trunk/Zend/Mail/Protocol/Imap.php(285): Zend_Mail_Protocol_Imap->_nextTaggedLine(NULL) #2 /home/dev/trunk/Zend/Mail/Protocol/Imap.php(587): Zend_Mail_Protocol_Imap->readLine(NULL, 'TAG103') #3 /home/dev/trunk/Zend/Mail/Storage/Imap.php(353): Zend_Mail_Protocol_Imap->fetch('UID', 12267) #4 /home/dev/trunk/model/gmail_imap_oauth.class.php(121): Zend_Mail_Storage_Imap->getUniqueId(12267)
Is there a possible way to keep the connection alive for a longer duration ? I'm running this script via command line and tried increasing the script max runtime in php.ini, it didn't help.