Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Maximum execution time of 30 seconds exceeded in MySQLDatabase.php


Go to End


3 Posts   3646 Views

Avatar
beren

Community Member, 9 Posts

29 October 2012 at 10:03pm

Edited: 29/10/2012 10:41pm

Hi,

I am new here.
Been working on my website and i found SilverStripe very nice and cool ;)

I've learn how to add additional custom Content fields to CMS and created page with total 7 Content Editors.
I've been adding content to them and after some time got this error after clicking on Save and Publish button.

Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\framework\model\MySQLDatabase.php on line 120

This line is:

$handle = $this->dbConn->query($sql);

I've been trying to find same issue on web but i did not find. I'been trying to change some timeout values but it does not work also.

i got XAMPP v. 3.0.12
PHPMyAdmin version is 3.5.3
SS verision 3.0.2

I can edit another page and Save and publish it.

This can be due to much content added? I've added lots of small 19x19 png files.
I will try to delete them but anyway I would like to have lot of content on page.. and it should be possible nowadays :)

EDIT:
I've deleted all the images (like 100 of them) and the page saved and publish...
So there is some memory issues.
Any limitation for Page ?

It's quite important as my page can be large even without those images. Some images may need to be necessary.
Any way to make SS use more memory or?

Any help will be great..

Avatar
Sean

Forum Moderator, 922 Posts

30 October 2012 at 1:57pm

Edited: 30/10/2012 2:05pm

If you take away your custom code, saving a generic page works fine in the CMS?

It's not normal to take more than 30 seconds to query, even on heavily customised page types in the CMS.

Could you debug what query is running to take so long? (add a var_dump($sql) above the query and run the Save and Publish again)

What sort of custom code did you add? Any snippets of code to be seen?

Assuming you're on Windows, I would also advise using "127.0.0.1" as the server name in your _config.php file instead of "localhost".
Sometimes, that's been known to fix performance issues because there have been known issues with DNS and MySQL on Windows.

Sean

Avatar
beren

Community Member, 9 Posts

5 November 2012 at 9:06pm

Edited: 05/11/2012 9:08pm

Hi Sean,
Thanks a lot for replaying!

Sorry for not getting back to you earlier but i was on short holidays.

I've deleted all of the small images (.png 19x19) and used html entities instead and the page saves.

My custom code in:
Download.php

<?php

class Downloads extends SiteTree { 
   static $db = array( 
	'ServicePacks' => 'HTMLText', 
	'CADRasterDownloads' => 'HTMLText',
	'HyperDocDownloads' => 'HTMLText',
	'SuperEditDownloads' => 'HTMLText',
	'OtherDownloads' => 'HTMLText'
   
   ); 
   static $has_one = array( 
); 
function getCMSFields() { 
		$fields = parent::getCMSFields(); 
		$fields->addFieldToTab('Root.Content.Main', new HTMLEditorField('ServicePacks', 'ServicePacks tab'));
		$fields->addFieldToTab('Root.Content.Main', new HTMLEditorField('CADRasterDownloads', 'CADRasterDownloads tab'));
		$fields->addFieldToTab('Root.Content.Main', new HTMLEditorField('HyperDocDownloads', 'HyperDocDownloads tab'));
		$fields->addFieldToTab('Root.Content.Main', new HTMLEditorField('SuperEditDownloads', 'SuperEditDownloads tab'));
		$fields->addFieldToTab('Root.Content.Main', new HTMLEditorField('OtherDownloads', 'OtherDownloads tab'));
		
return $fields; 
}

}

class Downloads_Controller extends ContentController { 
   function init() { 
      parent::init(); 
       
      
   } 
}

?>

and part of Download.ss is:

<ul id="tabs">
					<li><a href="#" name="tab1">Latest versions</a></li>
					<li><a href="#" name="tab2">Service Packs</a></li>
					<li><a href="#" name="tab3">CADRaster</a></li>
					<li><a href="#" name="tab4">HyperDoc</a></li>
					<li><a href="#" name="tab5">Super Edit</a></li>
					<li><a href="#" name="tab6">Other</a></li>
				
    
				</ul>

				<div id="tab-content"> 
					<div id="tab1"><br />$Content</div>
					<div id="tab2"><br />$ServicePacks</div>
					<div id="tab3"><br />$CADRasterDownloads</div>
					<div id="tab4"><br />$HyperDocDownloads</div>
					<div id="tab5"><br />$SuperEditDownloads</div>
					<div id="tab6"><br />$OtherDownloads</div>

with some script to it in the header:

<script type="text/javascript" src="$ThemeDir/js/jquery-latest.min.js"></script>
			<script type="text/javascript">
				$(document).ready(function() {
					$('#tab-content').children('div').hide(); // Initially hide all content
					$("#tabs li:first").attr("id","current"); // Activate first tab
					$("#tab-content div:first").fadeIn(); // Show first tab content
					
					$('#tabs a').click(function(e) {
						e.preventDefault();
						if ($(this).closest("li").attr("id") == "current"){ //detection for current tab
						 return       
						}
						else{             
						$('#tab-content').children('div').hide(); //Hide all content
						$("#tabs li").attr("id",""); //Reset id's
						$(this).parent().attr("id","current"); // Activate this
						$('#' + $(this).attr('name')).fadeIn(); // Show content for current tab
						}
					});
				});
			</script>

If I run into this problem again (maybe if I add more content) i will debug this.

Also, thanks for the tip with server name.
I think it helped and pages load faster :)