T
T
Turar Abu2016-05-14 19:38:31
PHP
Turar Abu, 2016-05-14 19:38:31

How to increase Magento connection timeout?

When generating a sitemap file on Magento, it gives an error:

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away, query was: SELECT `main_table`.`page_id`, `main_table`.`identifier` AS `url` FROM `cms_page` AS `main_table` INNER JOIN `cms_page_store` AS `store_table` ON main_table.page_id=store_table.page_id WHERE (main_table.is_active=1) AND (store_table.store_id IN(0, '1'))

without adding the sitemap.xml itself.
I'm not exactly sure why this is, but I think that the connection breaks before the script completes, since the site has 8000 products and it simply does not have time.
I'm working with Magento for the first time and I don't know what connection it uses (mysql, mysqli, PDO, etc.), otherwise, I would write something like:
mysql_query("SET GLOBAL connect_timeout=28800")
How can I increase the Magento connection timeout? Or if there are other options please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2016-05-19
@khrisanfov

You can copy the file lib/Varien/Db/Adapter/Pdo/Mysql.php to app/local/Varien/Db/Adapter/Pdo/Mysql.php and run $this->_connection->query("SET GLOBAL connect_timeout=28800");, it is better to write such things in my.cnf. But it seems to me that you have a problem in something else, 8000 products are not enough.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question