PHPBB sessions table filling up – A Big Mistake!

This issue took me weeks to fix it. It started when we started working on a new ratings module for PHPBB forum at popular website. I noticed (the client also knew) that a few of forum tables filled very fast and kept growing with the time. The database grew fast hence the website would go very slow and even go hanged up frequently. PHPBB sessions table was almost 2GB when I first time saw it!

We had to clean three tables (tbl_sessions, tbl_sessions_keys, tbl_confirm) manually and restart the server once or twice a day to keep the website up and running. Later on, when we were finished with the ratings module we decided to go to the root of this problem. I did some r&d on this issue but didn’t find anything useful. I found another topic with similar issue raised by someone at PHPBB website but there was no prompt reply to it. There was a reason for not finding the solution though!


Actually, PHPBB by default would clean unwanted stuff (sessions, queues, warnings, database and caching ; queue, tidy_cache, tidy_warnings, tidy_database, tidy_search, tidy_sessions) every hour automatically. There is a page_footer() function in /includes/functions.php file which creates a “RUN_CRON_TASK” variable which in turn is called in the /style/themeName/template/overall_footer.html file, like this:

[html]<!– IF not S_IS_BOT –>{RUN_CRON_TASK}<!– ENDIF –>[/html]

Unfortunately the previous developer had removed this line from the template/overall_footer.html file. The issue was fixed by placing this line back in the footer file and website started to work smoothly once again.

So, if any of you find your PHPBB forum go slow and enlarging of tables, such as PHPBB sessions table, you might want to have a look of the status of this cron function call. Cleaning of these tables manually may fix the slow down temporarily but the actual solution is a proper call to page_footer().

Leave a Reply