Server 500 Error - Feed.php

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Suggested Hosts
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: phpBB 3.1.x is at its End of Life stage and support will NOT be provided after July 1st, 2018.
Locked
jcocking
Registered User
Posts: 197
Joined: Wed Jun 08, 2005 6:47 pm

Server 500 Error - Feed.php

Post by jcocking »

Support Request Template
What version of phpBB are you using? phpBB 3.1.10
What is your board's URL? ip address only/access via hosts table
Who do you host your board with? Digital Ocean VPS
How did you install your board? I used the download package from phpBB.com
What is the most recent action performed on your board? Update from a previous version of phpBB3
Is registration required to reproduce this issue? No
Do you have any MODs installed? No
Do you have any extensions installed? No
What version of phpBB3 did you update from? phpBB 3.0.11
What styles do you currently have installed? Prosilver
What language(s) is your board currently using? EN
Which database type/version are you using? MariaDB 10.1.18
What is your level of experience? Experienced with PHP and phpBB
What actions did you take (updating your board; installing a MOD, style or extension; etc.) prior to this problem becoming noticeable?
Upgraded board from 3.0.x to 3.1.10. Everything works except for the couple of feeds.
Please describe your problem. Getting very weird issues with atom feed generator:
  • feed.php - 500 error
  • feed.php?mode=topics - 500 error
  • feed.php?mode=topic_active - 500 error
  • feed.php?mode=news - 500 error
  • feed.php?mode=forums - Works just fine
  • feed.php?f=## - work just fine
I have:
  • Verified clean install.
  • Verified file permission are correct.
  • validated chmod is correct.
  • Validated feed system is correctly configured.
  • Reviewed nginx and php logs. It only shows Server 500 error and no additional details. Server is in debug mode and no additional data.
What am I missing?

Feed setup:
Image
LotusElan.net is a fully responsive phpBB forum dedicated to the Lotus Elan Sportscars of the 1960s.
jcocking
Registered User
Posts: 197
Joined: Wed Jun 08, 2005 6:47 pm

Re: Server 500 Error - Feed.php

Post by jcocking »

Working through the phpBB Feed code, I have found the offending line within phpBB3/phpbb/feed/attachments_base.php.

Code: Select all

		while ($row = $this->db->sql_fetchrow($result))
		{
			$this->attachments[$row['post_msg_id']][] = $row;
		}
		$this->db->sql_freeresult($result);
I can comment out the $this->attachments[$row['post_msg_id']][] = $row; and the code will run. Uncomment out the line and I get an immediate Server 500 error.

This baffles me why a simple variable assignment would get a server 500 error.

I have:
1. validated the sql statement is correct.
2. validated the while loop is working (placed a print_r($row);)
3. validated the data in the loop was correct.
LotusElan.net is a fully responsive phpBB forum dedicated to the Lotus Elan Sportscars of the 1960s.
jcocking
Registered User
Posts: 197
Joined: Wed Jun 08, 2005 6:47 pm

Re: Server 500 Error - Feed.php

Post by jcocking »

Update:

If I change

Code: Select all

$this->attachments[$row['post_msg_id']][] = $row;
to

Code: Select all

$this->attachments[$row['post_msg_id']]['0'] = $row;
Everything works great. remove the '0' and I get server 500 errors.

And before you ask, php version:

Code: Select all

PHP 5.6.26-2+deb.sury.org~xenial+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
php.ini : memory limit at 128M,

Suggestions.....
LotusElan.net is a fully responsive phpBB forum dedicated to the Lotus Elan Sportscars of the 1960s.
jcocking
Registered User
Posts: 197
Joined: Wed Jun 08, 2005 6:47 pm

Re: Server 500 Error - Feed.php

Post by jcocking »

This has to be a memory issue. My attachment table has over 70K items. The feed program is bringing all the attachments since the beginning of time for a rss feed. Most rss feeds are 15 to 30 items. Overkill and performance impacting.

I added a time limit to the sql statement and everything is work as designed.

Line added (about line 39):

Code: Select all

		$sql_array['WHERE'] .= 'AND a.filetime > ' . (int) strtotime("-30 day") . ' ';
after:

Code: Select all

		$sql_array = array(
			'SELECT'   => 'a.*',
			'FROM'     => array(
				ATTACHMENTS_TABLE => 'a'
			),
			'WHERE'    => 'a.in_message = 0 ',
			'ORDER_BY' => 'a.filetime DESC, a.post_msg_id ASC',
		);
feels like an old 3.0.x mod
LotusElan.net is a fully responsive phpBB forum dedicated to the Lotus Elan Sportscars of the 1960s.
elawrenc
Registered User
Posts: 136
Joined: Thu Jul 21, 2011 2:41 pm

Re: Server 500 Error - Feed.php

Post by elawrenc »

I had the same issue. I will make the code change as well.
Locked

Return to “[3.1.x] Support Forum”