cPanel Memory Limit Reached & WordPress Database Error “Commands out of sync

Here’s how you can update your Stack Overflow question with the information about the PHP INI Editor options:


Title: cPanel Memory Limit Reached & WordPress Database Error “Commands out of sync”

Question:

When I go to the PHP INI Editor in cPanel, I see two options for configuration:

  1. One for my domain (e.g., domain.com)
  2. One for the directory (Root)

I have only configured the settings for public_html (my domain) and not for the root directory. Should I apply the same settings to the root directory as well?

I am facing an issue where my memory limit usage exceeds in cPanel despite configuring my PHP settings in php.ini, .user.ini, and .htaccess files in public_html. My current configuration is:

display_errors = Off
max_execution_time = 900
max_input_time = 900
max_input_vars = 1000
memory_limit = 512M
post_max_size = 512M
session.gc_maxlifetime = 1440
session.save_path = "/var/cpanel/php/sessions/ea-php81"
upload_max_filesize = 512M
zlib.output_compression = Off
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT

I have also added memory limits in wp-config.php:

// ** Performance Optimizations ** //
define('WP_MEMORY_LIMIT', '512M'); // Increase memory limit
define('WP_MAX_MEMORY_LIMIT', '512M');

I am using a LiteSpeed server with SSD NVMe and the LiteSpeed Cache plugin, but I keep hitting my I/O memory limit.

Server Statistics:

  • I/O Usage: 1.15 MB/s / 4 MB/s (28.76%)
  • CPU Usage: 24 / 100 (24%)
  • Physical Memory Usage: 209.55 MB / 4 GB (5.12%)
  • Disk Usage: 6.24 GB / 150 GB (4.16%)
  • Entry Processes: 1 / 60 (1.67%)

Error Log from WordPress:

In addition to memory usage issues, I am getting the following database error in my WordPress logs:

[04-Mar-2025 06:02:47 UTC] WordPress database error Commands out of sync; you can't run this command now for query 
SELECT option_value FROM wp_options WHERE option_name = 'wc_pending_batch_processes' LIMIT 1 
made by shutdown_action_hook, do_action('shutdown'), WP_Hook->do_action, WP_Hook->apply_filters, 
AutomatticWooCommerceInternalBatchProcessingBatchProcessingController->AutomatticWooCommerceInternalBatchProcessing{closure}, 
AutomatticWooCommerceInternalBatchProcessingBatchProcessingController->remove_or_retry_failed_processors, 
AutomatticWooCommerceInternalBatchProcessingBatchProcessingController->get_enqueued_processors, get_option

Questions:

  1. Should I configure the PHP INI settings for both public_html and the root directory?
  2. Is my PHP and WordPress configuration incorrect?
  3. Could this error be related to my I/O limit being exceeded?
  4. What could be causing the “Commands out of sync” database error, and how do I fix it?
  5. Could WooCommerce batch processing or a caching issue be the reason for the high resource usage?
  6. How can I debug and optimize my server and WordPress settings to prevent this from happening?