Cpanel Webmail Search Timeouts – Horde, RoundCube, Squirrelmail

If you get getting various errors when trying to search in webmail on a cpanel server similar to:

ERROR
ERROR: Connection dropped by IMAP server.
Query: SEARCH CHARSET “ISO-8859-1” ALL SUBJECT “searchterm”
Reason Given:

No Messages Found
SquirrelMail notice messages
Category:     PHP
Message:     Undefined index: A004
FILE:     /usr/local/cpanel/base/3rdparty/squirrelmail/functions/imap_general.php
LINE:     60

It’s likely that you have a large number of emails in your inbox. If possible try to remove any emails like spam or messages you’ll never need again. Also if you can sort any of the emails into separate folders that would help as well.

If you are still getting the errors, you would want to ssh in to the server and run this command:

vim /usr/local/cpanel/3rdparty/php/54/etc/php.ini

You can search for the line that says “default_socket_timeout” and I usually make the following change:

default_socket_timeout = 60 –> 600

Save the file and then run:

/usr/local/cpanel/bin/install_php_inis

Then the search should hopefully start working after that. If you get the same error and it times out around 10 minutes then you might need to raise it higher. I don’t really know any other way to increase the speed of the search as I think it does a slow file by file search each time, not using any indexing or anything like that. Other faster Solutions might be downloading the emails to a local mail client or switching your emails to Google Apps.