[Solved] Fatal Erro...
 
Notifications
Clear all

[Solved] Fatal Error - Exceeds Execution Time [Upgrade]

13 Posts
2 Users
0 Reactions
3,436 Views
(@tsula)
Posts: 11
Active Member
Topic starter
 

URL to your eFiction: http://www.Fos-ff.net/
Version of eFiction: 2.0.7
Have you bridged eFiction, if so with what?: No
Version of PHP: 5
Version of MySQL: 4.x
Have you searched for your problem: yes
If so, what terms did you try: Fatal error: Maximum execution time of 30 seconds exceeded in
State the nature of your problem: Receiving an error while trying to upgrade.
Do you have a test account for us? no

On step 18, I get this error after various amounts of time when I hit continue.

Fatal error: Maximum execution time of 30 seconds exceeded in /home/fosffnet/public_html/includes/mysql_functions.php on line 16

It doesn't make any sense, since a lot of other things take longer than 30 seconds and go through. But, it doesn't even show up after 30 seconds either.. can take 10 seconds or 10 minutes. c.c

Also, the line and sometimes the file changes.. 18, 16, and 27 have been the lines I have seen show up. Also there was an error in the review file that showed up too.. it seems to happen randomly.


"You're a prefect? Oh Ronnie! That's everyone in the family!"

"What are Fred and I? Next door neighbours?"

 
Posted : 17/10/2007 7:28 am
(@tammy)
Posts: 2577
Member Moderator
 

Did you check with your host?  If it were happening in one specific place I would say it's probably the script, but since it's happening randomly, it might be something with the host.  How big is your archive?  How many members?  How many stories?  You may want to optimize the database before you begin the upgrade.  It might help.


 
Posted : 17/10/2007 11:37 am
(@tsula)
Posts: 11
Active Member
Topic starter
 

All other things are going through fine, so I don't think it is the host. And we are a big archive, about 6000 members, 3500 authors, somewhere around 10,000 stories I think..

How would I go about optimizing the database though?

Also, since it is only happening on that particular step, could it be that I need to CHMOD seriesreviews.php to something else? It's 644 right now.


"You're a prefect? Oh Ronnie! That's everyone in the family!"

"What are Fred and I? Next door neighbours?"

 
Posted : 17/10/2007 3:40 pm
(@tammy)
Posts: 2577
Member Moderator
 

How many series do you have?  All that step does is update the counts of reviews and the rating for your series.  You could skip ahead to step 19 and just let the reviews for series correct themselves as new reviews are added.  Or we could probably cobble together a script to let you update the series a few at a time.


 
Posted : 17/10/2007 4:06 pm
(@tsula)
Posts: 11
Active Member
Topic starter
 

A lot. c.c And I tried skipping the step and it ended up giving me an error after I hit automatic.

A fatal MySQL error was encountered.
Query: alter table fanfiction_categories drop index category;
Error: (1091) Can't DROP 'category'; check that column/key exists

Though, when I hit the option to do it manually, it said this:

Manually optimize the database now using the optimize.sql found in the docs/ folder now. You may now delete the following files and directories:

    * messages/ folder
    * your databasepath folder and dbconfig.php file
    * blocks_config.php
    * categories.php (handled through browse.php)
    * formselect.js
    * func.naughty.php
    * func.pagemenu.php
    * func.ratingpics.php
    * functions.php
    * func.reviewform.php
    * help.php (saved in the database now)
    * javascript.js (A new version has been placed in the includes/ folder)
    * lib/ folder
    * members_list.php (A new version has been placed in the includes/ folder)
    * naughtywords.php
    * seriesblock.php (A new version has been placed in the includes/ folder)
    * storyblock.php (A new version has been placed in the includes/ folder)
    * submission.php (saved in the database now)
    * timefunctions.php
    * titles.php (handled through browse.php)
    * tos.php (saved in the database now)
    * install/ folder

You are also encouraged to CHMOD config.php to 644 as a security measure.

So it seems to work that way, but I don't know how to do it manually. ><;


"You're a prefect? Oh Ronnie! That's everyone in the family!"

"What are Fred and I? Next door neighbours?"

 
Posted : 17/10/2007 6:03 pm
(@tammy)
Posts: 2577
Member Moderator
 

Use phpMyAdmin.  Copy and paste the optimize.sql file from the docs/ folder into the SQL window in phpmyadmin.  You'll want to delete the 4th line in that file though as you don't seem to have the index "category" in the categories table.


 
Posted : 17/10/2007 6:42 pm
(@tsula)
Posts: 11
Active Member
Topic starter
 

Okay, I did that and got this error:

Error

SQL query:

ALTER TABLE fanfiction_authorinfo ADD PRIMARY KEY ( uid, field ) ;

MySQL said: Documentation
#1068 - Multiple primary key defined

And then I deleted the files it said to get rid of and took a look at the site, but I am still getting an old error. It only started to show up after I signed in though:

A fatal MySQL error was encountered.
Query: SELECT nid, author, title, story, UNIX_TIMESTAMP(time) as date, comments FROM fanfiction_news ORDER BY time DESC LIMIT 1
Error: (1054) Unknown column 'comments' in 'field list'

I don't get the error at all if I am logged out.. but I had to delete the cookies to that site to even be able to log out. c.c

I take that back.. I get it when changing skins too. c.c

http://fos-ff.net/maintenance.php


"You're a prefect? Oh Ronnie! That's everyone in the family!"

"What are Fred and I? Next door neighbours?"

 
Posted : 18/10/2007 9:57 am
(@tammy)
Posts: 2577
Member Moderator
 

You're missing a piece from step 19. 

Goto Admin->Custom pages.  If you have tinyMCE enabled, click on the checkbox to disable it.  Enter something in the name then enter the following in the box and PREVIEW it.


<?php
dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_inseries` DROP `updated`");
dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_news` ADD `comments` INT NOT NULL DEFAULT '0'");
dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_series` ADD `numstories` INT NOT NULL DEFAULT '0'");
$serieslist = dbquery("SELECT seriesid FROM ".TABLEPREFIX."fanfiction_series");
$totalseries = dbnumrows($serieslist);
$newslist = dbquery("SELECT count(cid) as count, nid FROM ".TABLEPREFIX."fanfiction_comments GROUP BY nid");
while($n = dbassoc($newslist)) {
dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = '".$n['count']."' WHERE nid = ".$n['nid']);
}

$storiesquery =dbquery("SELECT COUNT(sid) as totals, COUNT(DISTINCT uid) as totala, SUM(wordcount) as totalwords FROM ".TABLEPREFIX."fanfiction_stories WHERE validated > 0 ");
list($stories, $authors, $words) = dbrow($storiesquery);
dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET stories = '$stories', authors = '$authors', wordcount = '$words' WHERE sitekey = '".SITEKEY."'");

$chapterquery = dbquery("SELECT COUNT(chapid) as chapters FROM ".TABLEPREFIX."fanfiction_chapters where validated > 0");
list($chapters) = dbrow($chapterquery);

$authorquery = dbquery("SELECT COUNT(uid) as totalm FROM ".TABLEPREFIX."fanfiction_authors");
list($members) = dbrow($authorquery);

list($newest) = dbrow(dbquery("SELECT uid as uid FROM ".TABLEPREFIX."fanfiction_authors ORDER BY uid DESC LIMIT 1"));
$reviewquery = dbquery("SELECT COUNT(reviewid) as totalr FROM ".TABLEPREFIX."fanfiction_reviews WHERE review != 'No Review'");
list($reviews) = dbrow($reviewquery);
$reviewquery = dbquery("SELECT COUNT(uid) FROM ".TABLEPREFIX."fanfiction_reviews WHERE review != 'No Review' AND uid != 0");
list($reviewers) = dbrow($reviewquery);
dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET series = '$totalseries', chapters = '$chapters', members = '$members', newestmember = '$newest', reviews = '$reviews', reviewers = '$reviewers' WHERE sitekey = '".SITEKEY."'");
while($s = dbassoc($serieslist)) {
$numstories = count(storiesInSeries($s['seriesid']));
dbquery("UPDATE ".TABLEPREFIX."fanfiction_series SET numstories = '$numstories' WHERE seriesid = ".$s['seriesid']." LIMIT 1");
}
$alltables = dbquery("SHOW TABLES");
while ($table = dbassoc($alltables)) {
foreach ($table as $db => $tablename) {
dbquery("OPTIMIZE TABLE `".$tablename."`");
}
}
function storiesInSeries($thisseries) {

$storylist = array( );
$serieslist = array( );
$stinseries = dbquery("SELECT sid, subseriesid FROM ".TABLEPREFIX."fanfiction_inseries WHERE seriesid = '$thisseries'");
while($st = dbassoc($stinseries)) {
if(!empty($st['sid'])) $storylist[] = $st['sid'];
else if(!empty($st['subseriesid'])) $serieslist[] = $st['subseriesid'];
}
if($serieslist) {
foreach($serieslist as $s) {
$storylist = array_merge($storylist, storiesInSeries($s));
}
}
return $storylist;
}
?>

You might time out on this one too as it does some updates on the series, but I put that at the end, so you should get through the rest of it.  And if that fixes everything but the series, we can write a script to take care of that. 


 
Posted : 18/10/2007 11:42 am
(@tsula)
Posts: 11
Active Member
Topic starter
 

It refuses to let me into the admin area, all it shows now is that weird error.


"You're a prefect? Oh Ronnie! That's everyone in the family!"

"What are Fred and I? Next door neighbours?"

 
Posted : 18/10/2007 11:46 am
(@tammy)
Posts: 2577
Member Moderator
 

Alright, let me see what I can come up with.


 
Posted : 18/10/2007 1:05 pm
(@tammy)
Posts: 2577
Member Moderator
 

Copy the following into a file and call it fix.php. Upload that to your main efiction directory then goto that url (i.e. www.yoursite.com/fix.php).


<?php
define("_BASEDIR", "");
include("config.php");
$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );
$settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");
list($tableprefix, $language) = dbrow($settings);
define("TABLEPREFIX", $tableprefix);
define("SITEKEY", $sitekey);
define("_CHARSET", "test");
function storiesInSeries($thisseries) {

$storylist = array( );
$serieslist = array( );
$stinseries = dbquery("SELECT sid, subseriesid FROM ".TABLEPREFIX."fanfiction_inseries WHERE seriesid = '$thisseries'");
while($st = dbassoc($stinseries)) {
if(!empty($st['sid'])) $storylist[] = $st['sid'];
else if(!empty($st['subseriesid'])) $serieslist[] = $st['subseriesid'];
}
if($serieslist) {
foreach($serieslist as $s) {
$storylist = array_merge($storylist, storiesInSeries($s));
}
}
return $storylist;
}

function isNumber($num) {
if(empty($num)) return false;
if(!is_string($num)) return false;
return preg_match("/^[0-9]+$/", $num);
}

Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');
header ("Pragma: no-cache");
header ("Expires: 0");

//make a new TemplatePower object
echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>eFiction $version Install</title>
<link rel="stylesheet" type="text/css" href="'../default_tpls/style.css'></head>";"

include ("includes/class.TemplatePower.inc.php");
$tpl = new TemplatePower( "default_tpls/default.tpl" );
$tpl->assignInclude( "header", "./default_tpls/header.tpl" );
$tpl->assignInclude( "footer", "./default_tpls/footer.tpl" );
$tpl->prepare( );
$tpl->newBlock("header");
$tpl->assign("sitename", "eFiction Install Fix");
$tpl->gotoBlock( "_ROOT" );
$tpl->newBlock("footer");
$tpl->assign( "footer", "---");

$step = isset($_GET['step']) ? 2 : 1;
if($step == 1) {
dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_inseries` DROP `updated`");
dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_news` ADD `comments` INT NOT NULL DEFAULT '0'");
dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_series` ADD `numstories` INT NOT NULL DEFAULT '0'");
list($totalseries) = dbrow(dbquery("SELECT COUNT(seriesid) FROM ".TABLEPREFIX."fanfiction_series"));
$newslist = dbquery("SELECT count(cid) as count, nid FROM ".TABLEPREFIX."fanfiction_comments GROUP BY nid");
while($n = dbassoc($newslist)) {
dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = '".$n['count']."' WHERE nid = ".$n['nid']);
}
$storiesquery =dbquery("SELECT COUNT(sid) as totals, COUNT(DISTINCT uid) as totala, SUM(wordcount) as totalwords FROM ".TABLEPREFIX."fanfiction_stories WHERE validated > 0 ");
list($stories, $authors, $words) = dbrow($storiesquery);
dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET stories = '$stories', authors = '$authors', wordcount = '$words' WHERE sitekey = '".SITEKEY."'");
$chapterquery = dbquery("SELECT COUNT(chapid) as chapters FROM ".TABLEPREFIX."fanfiction_chapters where validated > 0");
list($chapters) = dbrow($chapterquery);
$authorquery = dbquery("SELECT COUNT(uid) as totalm FROM ".TABLEPREFIX."fanfiction_authors");
list($members) = dbrow($authorquery);

list($newest) = dbrow(dbquery("SELECT uid as uid FROM ".TABLEPREFIX."fanfiction_authors ORDER BY uid DESC LIMIT 1"));
$reviewquery = dbquery("SELECT COUNT(reviewid) as totalr FROM ".TABLEPREFIX."fanfiction_reviews WHERE review != 'No Review'");
list($reviews) = dbrow($reviewquery);
$reviewquery = dbquery("SELECT COUNT(uid) FROM ".TABLEPREFIX."fanfiction_reviews WHERE review != 'No Review' AND uid != 0");
list($reviewers) = dbrow($reviewquery);
dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET series = '$totalseries', chapters = '$chapters', members = '$members', newestmember = '$newest', reviews = '$reviews', reviewers = '$reviewers' WHERE sitekey = '".SITEKEY."'");
$output = "<a href="'fix.php?step=2'>Continue</a>";"
}
else {
$offset = isset($_GET['offset']) && isNumber($_GET['offset']) ? $_GET['offset'] : 0;
list($totalseries) = dbrow(dbquery("SELECT COUNT(seriesid) FROM ".TABLEPREFIX."fanfiction_series"));
if($offset < $totalseries) {
$series = dbquery("SELECT seriesid FROM ".TABLEPREFIX."fanfiction_series LIMIT $offset, 20");
while($s = dbassoc($series)) {
$numstories = count(storiesInSeries($s['seriesid']));
include("includes/seriesreviews.php");
echo $s['seriesid']."<br />";
dbquery("UPDATE ".TABLEPREFIX."fanfiction_series SET numstories = '$numstories' WHERE seriesid = ".$s['seriesid']." LIMIT 1");
}
$newoffset = $offset + 20;
if($totalseries > $newoffset) $output = "<a href="'fix.php?step=2&amp;offset=$newoffset'>Continue</a>";"
else $output = "Finished";
}
else {
$alltables = dbquery("SHOW TABLES");
while ($table = dbassoc($alltables)) {
foreach ($table as $db => $tablename) {
dbquery("OPTIMIZE TABLE `".$tablename."`");
}
}
$output = "Finished";
}
}
$tpl->gotoBlock( "_ROOT" );
$tpl->assign("output", $output);

$tpl->printToScreen();
dbclose( );
?>


 
Posted : 18/10/2007 3:03 pm
(@tsula)
Posts: 11
Active Member
Topic starter
 

The script went all weird on me when I added it:

{rtf1ansiansicpg1252deff0deflang1033{fonttbl{f0fswissfcharset0 Arial;}}
{*generator Msftedit 5.41.15.1507;}viewkind4uc1pardf0fs20 <?phppar
define("_BASEDIR", "");par
include("config.php");par
$dbconnect = dbconnect($dbhost, $dbuser, $dbpass, $dbname );par
$settings = dbquery("SELECT tableprefix, language FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '".$sitekey."'");par
list($tableprefix, $language) = dbrow($settings);par
define("TABLEPREFIX", $tableprefix);par
define("SITEKEY", $sitekey);par
define("_CHARSET", "test");par
function storiesInSeries($thisseries) {par
tabpar
tabtab $storylist = array( );par
tab $serieslist = array( );par
tab $stinseries = dbquery("SELECT sid, subseriesid FROM ".TABLEPREFIX."fanfiction_inseries WHERE seriesid = '$thisseries'");par
tab while($st = dbassoc($stinseries)) { par
tabtab if(!empty($st['sid'])) $storylist[] = $st['sid'];par
tabtab else if(!empty($st['subseriesid'])) $serieslist[] = $st['subseriesid'];par
tab}par
tab if($serieslist) {par
tabtab foreach($serieslist as $s) {par
tabtabtab $storylist = array_merge($storylist, storiesInSeries($s));par
tabtab}par
tab}par
tab return $storylist;par
}par
par
function isNumber($num) {par
tab if(empty($num)) return false;par
tab if(!is_string($num)) return false;par
tab return preg_match("/^[0-9]+$/", $num);par
}par
par
Header('Cache-Control: private, no-cache, must-revalidate, max_age=0, post-check=0, pre-check=0');par
header ("Pragma: no-cache"); par
header ("Expires: 0"); par
par
//make a new TemplatePower objectpar
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \" http://www.w3.org/TR/html4/loose.dtd\">par
<html><head><title>eFiction $version Install</title>par
<link rel=\"stylesheet\" type=\"text/css\" href="'../default_tpls/style.css'></head>";par"
par
include ("includes/class.TemplatePower.inc.php");par
$tpl = new TemplatePower( "default_tpls/default.tpl" );par
$tpl->assignInclude( "header", "./default_tpls/header.tpl" );par
$tpl->assignInclude( "footer", "./default_tpls/footer.tpl" );par
$tpl->prepare( );par
$tpl->newBlock("header");par
$tpl->assign("sitename", "eFiction Install Fix");par
$tpl->gotoBlock( "_ROOT" );par
$tpl->newBlock("footer");par
$tpl->assign( "footer", "---");par
par
$step = isset($_GET['step']) ? 2 : 1;par
tab if($step == 1) {par
tab dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_inseries` DROP `updated`");par
tab dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_news` ADD `comments` INT NOT NULL DEFAULT '0'");par
tab dbquery("ALTER TABLE `".TABLEPREFIX."fanfiction_series` ADD `numstories` INT NOT NULL DEFAULT '0'");par
tab list($totalseries) = dbrow(dbquery("SELECT COUNT(seriesid) FROM ".TABLEPREFIX."fanfiction_series"));par
tab $newslist = dbquery("SELECT count(cid) as count, nid FROM ".TABLEPREFIX."fanfiction_comments GROUP BY nid");par
tab while($n = dbassoc($newslist)) {par
tabtab dbquery("UPDATE ".TABLEPREFIX."fanfiction_news SET comments = '".$n['count']."' WHERE nid = ".$n['nid']);par
tab}par
tab $storiesquery =dbquery("SELECT COUNT(sid) as totals, COUNT(DISTINCT uid) as totala, SUM(wordcount) as totalwords FROM ".TABLEPREFIX."fanfiction_stories WHERE validated > 0 ");par
tab list($stories, $authors, $words) = dbrow($storiesquery);par
tab dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET stories = '$stories', authors = '$authors', wordcount = '$words' WHERE sitekey = '".SITEKEY."'"); par
tab $chapterquery = dbquery("SELECT COUNT(chapid) as chapters FROM ".TABLEPREFIX."fanfiction_chapters where validated > 0");par
tab list($chapters) = dbrow($chapterquery);par
tab $authorquery = dbquery("SELECT COUNT(uid) as totalm FROM ".TABLEPREFIX."fanfiction_authors");par
tab list($members) = dbrow($authorquery);par
par
tab list($newest) = dbrow(dbquery("SELECT uid as uid FROM ".TABLEPREFIX."fanfiction_authors ORDER BY uid DESC LIMIT 1"));par
tab $reviewquery = dbquery("SELECT COUNT(reviewid) as totalr FROM ".TABLEPREFIX."fanfiction_reviews WHERE review != 'No Review'");par
tab list($reviews) = dbrow($reviewquery);par
tab $reviewquery = dbquery("SELECT COUNT(uid) FROM ".TABLEPREFIX."fanfiction_reviews WHERE review != 'No Review' AND uid != 0");par
tab list($reviewers) = dbrow($reviewquery);par
tab dbquery("UPDATE ".TABLEPREFIX."fanfiction_stats SET series = '$totalseries', chapters = '$chapters', members = '$members', newestmember = '$newest', reviews = '$reviews', reviewers = '$reviewers' WHERE sitekey = '".SITEKEY."'"); par
tab $output = "<a href="'fix.php?step=2'>Continue</a>";par"
tab}par
tab else {par
tabtab $offset = isset($_GET['offset']) && isNumber($_GET['offset']) ? $_GET['offset'] : 0;par
tabtab list($totalseries) = dbrow(dbquery("SELECT COUNT(seriesid) FROM ".TABLEPREFIX."fanfiction_series"));par
tabtab if($offset < $totalseries) {par
tabtabtab $series = dbquery("SELECT seriesid FROM ".TABLEPREFIX."fanfiction_series LIMIT $offset, 20");par
tabtabtab while($s = dbassoc($series)) {par
tabtabtabtab $numstories = count(storiesInSeries($s['seriesid']));par
tabtabtabtab include("includes/seriesreviews.php");par
tabtabtabtab echo $s['seriesid']."<br />";par
tabtabtabtab dbquery("UPDATE ".TABLEPREFIX."fanfiction_series SET numstories = '$numstories' WHERE seriesid = ".$s['seriesid']." LIMIT 1");par
tabtabtab}par
tabtabtab $newoffset = $offset + 20;par
tabtabtab if($totalseries > $newoffset) $output = "<a href="'fix.php?step=2&amp;offset=$newoffset'>Continue</a>";par"
tabtabtab else $output = "Finished";par
tabtab}par
tabtab else {par
tabtabtab $alltables = dbquery("SHOW TABLES");par
tabtabtab while ($table = dbassoc($alltables)) {par
tabtabtabtab foreach ($table as $db => $tablename) {par
tabtabtabtabtab dbquery("OPTIMIZE TABLE `".$tablename."`");par
tabtabtabtab}par
tabtabtab}par
tabtabtab $output = "Finished";par
tabtab}par
tab}par
$tpl->gotoBlock( "_ROOT" );par
$tpl->assign("output", $output);par
par
$tpl->printToScreen();par
dbclose( );par
?>par
}

Then it gave me this error on the site:

Warning: Unexpected character in input: '' (ASCII=92) state=1 in /home/fosffnet/public_html/fix.php on line 2

Parse error: syntax error, unexpected T_STRING in /home/fosffnet/public_html/fix.php on line 2

However, I just pasted in the script again and it went through. So far everything looks great~!  πŸ˜€ Thankies~~


"You're a prefect? Oh Ronnie! That's everyone in the family!"

"What are Fred and I? Next door neighbours?"

 
Posted : 18/10/2007 6:29 pm
(@tammy)
Posts: 2577
Member Moderator
 

Use notepad not wordpad or word.


 
Posted : 18/10/2007 6:30 pm
Share: