500 server errors when updating more than 50 products with variations

April 24, 2019 228 views
Apache MySQL Ubuntu 18.04

Site seems to work OK, with two processors and 4 GB Ram. MySQl on same server at the moment but if I use the standard woo-commerce bulk edit on more than 50 t-shirts each with 65 variations, it runs for ages and eventually fails with simple "this website is not responding" error 500

If I Htop my server, the processors are maxed at 100% and memory around 50%

In my wp-config file at the top I have:

define('WPMEMORYLIMIT', "2048M");
iniset('memorylimit', "2048M");

Yes thats 2GB to Word-press?? Is that too much and stealing from MySQL?

Its a multi-site install that I haven't finished the other installs so they are not being hit at all. I have this in my wp-config file:
define( 'WPALLOWMULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAININSTALL', false);
define('DOMAIN
CURRENTSITE', 'mysite.co.uk');
define('PATH
CURRENTSITE', '/');
define('SITE
IDCURRENTSITE', 1);
define('BLOGIDCURRENT_SITE', 1);

Also have this

/** Sets up WordPress vars and included files. */
requireonce(ABSPATH . 'wp-settings.php');
define('CONCATENATE
SCRIPTS', false);

My PHP.ini has silly settings such as

maxexecutiontime = 30000
maxinputtime = 60000
memory_limit = 512MB

I really get the feeling this is MySQL related but by php.ini settings and word-press memory limits might be creating this issues

Cheers

1 Answer

You will find that the iniset is most likely a WordPress wrapper for the php ini_set function (so it is trying to increase the memory limit to 2GB for PHP at execution time (although most php configurations running in safe mode would block this). As I understand it, WooCommerce and its bulk operations are fairly resource intensive.

It might be opportune to try adjusting the settings in php.ini directly:

  • Increase Memory Limits over server to 512M, 756M and switch them back after its deleted.
  • Increase Max execution time, this dimension of time is vital too in successfully executing a script over server. Increase this value to 60 (60000), 120 (120000) etc. And switch it back when you are done.

Here is a good guide on How To Change Your PHP Settings on Ubuntu 14.04, if you are unsure. Don't forget to restart your web-server after making the change, so they can be applied.

I understand that are also plugins that help with these type of operations, as it is a common theme that they crash the php parser, you might want to check out Sheet Editor for WooCommerce. It seems to be written just for these types of problems.

If all this doesn't work, just edit the products in smaller batches and see if that completes successfully.

by Jon Schwenn
PHP is a server side scripting language used by many popular CMS and blog platforms like WordPress and Drupal. It is also part of the popular LAMP and LEMP stacks. Updating the PHP configuration settings is a common task when setting up a PHP-based website. This guide will show how to view the current PHP configuration settings of your web server and how to make updates to the PHP settings.
Have another answer? Share your knowledge.