Welcome to Geeklog Saturday, August 24 2019 @ 07:49 am EDT

Geeklog Forums

Fatal error: Maximum execution time of 30 seconds exceeded


Status: offline

notivaga

Forum User
Newbie
Registered: 02/05/04
Posts: 13
I have some heavy users at my site, some of them with more than 1.000 stories.

When seaching using only the userid code (UID), the search class whas giving me error:

Fatal error: Maximum execution time of 30 seconds exceeded

Analysing the file search.class.php, I realized that when the UID is sent, this is not considered in the SQL, overbuffering the system. Then I changed:

line 222/223
ORIGINAL
if ($this->_type == 'all' OR $this->_type == 'stories') {
$sql = "SELECT sid,title,introtext,bodytext,hits,uid,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon,UNIX_TIMESTAMP(date) as day,'story' as type FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date _checkTopicPermissions ();

REPLACED
if ($this->_type == 'all' OR $this->_type == 'stories') {
// $sql = "SELECT sid,title,introtext,bodytext,hits,uid,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon,UNIX_TIMESTAMP(date) as day,'story' as type FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date _checkTopicPermissions ();

if (!empty ($_USER['uid'])) {
$sql = "SELECT sid,title,introtext,bodytext,hits,uid,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon,UNIX_TIMESTAMP(date) as day,'story' as type FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date _author') " . $this->_checkTopicPermissions ();
}
else {
$sql = "SELECT sid,title,introtext,bodytext,hits,uid,group_id,owner_id,perm_owner,perm_group,perm_members,perm_anon,UNIX_TIMESTAMP(date) as day,'story' as type FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date _checkTopicPermissions ();

It passed! But, again, the program started to give me another fatal error. This time, in another class file:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/soaresf/public_html/_geeklog/system/classes/template.class.php on line 499

I searched here in the forum, there is a suggestion for replacing this line. Instead of working, this hacking bring me more than 1000 lines of errors (BUT THERE WAS NOT FATAL ERRORS). I think that we are near the solution... May be this is related with strings with foreign characters... I have other users with more than 1000 stories wichh name HAS NO SPECIAL CHARACTERS and the system works (slowly but with NO FATAL ERRORS).

ORIGINAL
$varvals_quoted[$k] = preg_replace(array('/\\/', '/$/'), array('\\\\', '\\$'), $v);

SUGGESTION THAT IS NOT WORKING WELL
// $varvals_quoted[$k] = preg_replace(array('//', '/$/'), array('\', '$'), $v);

I search google and found 6 pages of links from GEEKLOG sites just giving the same information:

Fatal error: Maximum execution time of 30 seconds exceeded in .../system/classes/template.class.php on line 499

I tried another approach: to limit the number of search result in config.php:

// 0: use users max stories per page
// 1: Show all
// any other number is the # of results per page
$_CONF['max_search_results'] = 25; // era 0, deixei 25

// maximum length for the summary text for search results should be
$_CONF['summary_length'] = 50; // original era 100


No way. The system ever show all histories in a single page. It is very very heavy for users with low band internet and even for the server...

I think that this is an important issue. I reached my incompetence level, I tried a solution... May be somebody could help me.

Thanks a LOT

Notivaga

Status: offline

ByteEnable

Forum User
Full Member
Registered: 20/10/03
Posts: 138
I have seen this error also. However, I have only seen the error occur when I'm logged in, and its me getting the timeout. Checking the php_log, sure enough, its only me who see's this.

I've had up to 1500 people connected concurrently without any timeout's.

Byte
www.linuxelectrons.com

Status: offline

ByteEnable

Forum User
Full Member
Registered: 20/10/03
Posts: 138
I ran into the this same problem again. I can even reproduce the error here on this site. Just go to advanced search, use the word php as the search term, and 30 seconds later, presto, mostly blank white page with the max exec error message.

Status: offline

ByteEnable

Forum User
Full Member
Registered: 20/10/03
Posts: 138
Okay after some playing around... I limit the number of items searched......like so:

Line 301 in search.class.php

while ( ($A = DB_fetchArray($result_stories)) && ($story_results->num_searchresults
You can then add a warning message like so:

Too many matches for "search term" only 200 results returned. Please narrow your search for better results.

This is just a workaround. Whats really weird is that substr never gets executed in the searchStories as far as I can tell.

Byte

Status: offline

notivaga

Forum User
Newbie
Registered: 02/05/04
Posts: 13
Thanks for your suggestion. I will implement that. Of course, the best solution would be paginate the results, in steps ("google paging mode).

In my case, users search for author histories and some of them have more than 2000 histories published. In these cases, there is no way to narrow the search, since the "string" is the author´s name.

I am just finishing a new plugin where all authos can be searched by first name letter and then they have a special own page, called "SUBSITE". The subsite has all publications, paged in "google mode. And you can sort them by date, history name, number of visits, number of sents and so on. There are many other features. For sites that have many authors and many histories per author, it will be a very good choice.

My plan is to publish this plugin this month... I am just testing the alpha version and preparing documentation.

Thanks again by your help.

ByteEnable

Anonymous
PHP Formatted Code

while ( ($A = DB_fetchArray($result_stories)) && ($story_results->num_searchresults < 400) ) {

 


The forum stripped out my earlier code.


All times are EDT. The time is now 07:49 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content