Jump to content

500 internal server error what sql query to fix this ?


Recommended Posts

Hello community, I am stuck here, everything runs fine and once in a while i get a 500 timeout err so i turner on debug mode and this is what i got does this loofamiliar to anyone?

Thanks ahead, sincerly David


Lost connection to MySQL server during query
 

SELECT DISTINCT p.id_product, p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`id_product_attribute`, product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity, pl.`description`, pl.`description_short`, pl.`available_now`,					pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image`,					il.`legend`, m.`name` AS manufacturer_name, cl.`name` AS category_default,					DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(),					INTERVAL 0						DAY)) > 0 AS new, product_shop.price AS orderprice				FROM `ps_category_product` cp				LEFT JOIN `ps_product` p					ON p.`id_product` = cp.`id_product`				 INNER JOIN ps_product_shop product_shop		ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1)				LEFT JOIN `ps_product_attribute` pa				ON (p.`id_product` = pa.`id_product`)				 LEFT JOIN ps_product_attribute_shop product_attribute_shop		ON (product_attribute_shop.id_product_attribute = pa.id_product_attribute AND product_attribute_shop.id_shop = 1 AND product_attribute_shop.`default_on` = 1)				 LEFT 			JOIN ps_stock_available stock			ON (stock.id_product = p.id_product AND stock.id_product_attribute = 0 AND stock.id_shop = 1  AND stock.id_shop_group = 0  )				LEFT JOIN `ps_category_lang` cl					ON (product_shop.`id_category_default` = cl.`id_category`					AND cl.`id_lang` = 1 AND cl.id_shop = 1 )				LEFT JOIN `ps_product_lang` pl					ON (p.`id_product` = pl.`id_product`					AND pl.`id_lang` = 1 AND pl.id_shop = 1 )				LEFT JOIN `ps_image` i					ON (i.`id_product` = p.`id_product`) LEFT JOIN ps_image_shop image_shop		ON (image_shop.id_image = i.id_image AND image_shop.id_shop = 1 AND image_shop.cover=1)				LEFT JOIN `ps_image_lang` il					ON (image_shop.`id_image` = il.`id_image`					AND il.`id_lang` = 1)				LEFT JOIN `ps_manufacturer` m					ON m.`id_manufacturer` = p.`id_manufacturer`				WHERE  cp.id_category IN  (71,15,17,39,133,134,14,31,62,63,32,30,64,65,66,132,33,74,18,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,12,20,22,21,19,34,35,36,37,38,40,67,68,69,70,72,73,13,23,29,24,25,26,27,28)					AND  product_shop.`id_shop` = 1				AND (pa.id_product_attribute IS NULL OR product_attribute_shop.id_shop=1) 				AND (i.id_image IS NULL OR image_shop.id_shop=1)					 AND product_shop.`active` = 1 AND product_shop.`visibility` IN ("both", "catalog") ORDER BY `orderprice` ASC			LIMIT 0,500

at line 646 in file classes/db/Db.php

641. 			WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);642. 		}643. 		elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))644. 		{645. 			if ($sql)646. 				throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');647. 			throw new PrestaShopDatabaseException($this->getMsgError());648. 		}649. 	}650. 651. 	/**

 

Edited by David Dotou (see edit history)
Link to comment
Share on other sites

so i'm still working on the website and made reaper with the prestashop repair module it runs fine today untill now...?
 

SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`,			pl.`meta_keywords`, pl.`meta_title`, pl.`name`, pl.`available_now`, pl.`available_later`, MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` AS manufacturer_name,			product_shop.`date_add` > "2015-02-22" as newFROM `ps_product` p INNER JOIN ps_product_shop product_shop		ON (product_shop.id_product = p.id_product AND product_shop.id_shop = 1)LEFT JOIN `ps_product_lang` `pl` ON 			p.`id_product` = pl.`id_product`			AND pl.`id_lang` = 2 AND pl.id_shop = 1 LEFT JOIN `ps_image` `i` ON i.`id_product` = p.`id_product` LEFT JOIN ps_image_shop image_shop		ON (image_shop.id_image = i.id_image AND image_shop.id_shop = 1 AND image_shop.cover=1)LEFT JOIN `ps_image_lang` `il` ON i.`id_image` = il.`id_image` AND il.`id_lang` = 2LEFT JOIN `ps_manufacturer` `m` ON m.`id_manufacturer` = p.`id_manufacturer` LEFT 			JOIN ps_stock_available stock			ON (stock.id_product = p.id_product AND stock.id_product_attribute = 0 AND stock.id_shop = 1  AND stock.id_shop_group = 0  )WHERE (product_shop.`active` = 1) AND (product_shop.`visibility` IN ("both", "catalog")) AND (product_shop.`date_add` > "2015-02-22")GROUP BY product_shop.id_productORDER BY p.`date_add` ASCLIMIT 8

at line 646 in file classes/db/Db.php

641. 			WebserviceRequest::getInstance()->setError(500, '[SQL Error] '.$this->getMsgError().'. From '.(isset($dbg[3]['class']) ? $dbg[3]['class'] : '').'->'.$dbg[3]['function'].'() Query was : '.$sql, 97);642. 		}643. 		elseif (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS'))644. 		{645. 			if ($sql)646. 				throw new PrestaShopDatabaseException($this->getMsgError().'<br /><br /><pre>'.$sql.'</pre>');647. 			throw new PrestaShopDatabaseException($this->getMsgError());648. 		}649. 	}650. 651. 	/**
Edited by David Dotou (see edit history)
Link to comment
Share on other sites

ok thanks rocky i think i know when this happened now this is a free theme so i'm going to try to work it out because it said on the backoffice that when setting up the widgets "div" errors might occur that the developer will not support ... anyone to shine a light on what i could do to start fixing this?

Thanks ahead

Edited by David Dotou (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...