ChrisP777 ChrisP777 - 1 year ago 61
PHP Question

Exchanging Data between two different Wordpress databases

My wordpress website has two plugins that seems to be taking up a lot of memory. It eventually times out after 30 seconds when I try to pull up data or do certain tasks.

When one of the plugins are disabled, it performs a lot better. The problem is, these two plugins have to be activated because one is the payment gateway system WooCommerce. The other one is the learning management system LearnDash.

I am having ongoing communications with the plugin developers as they are kind enough to look into the problem.

Meanwhile, I am trying to see if it is possible to set up two wordpress instances. One at my main domain, and the other one at my sub domain. And Hopefully, I can set up the main domain as a place where people can purchase the product, and the subdomain has the learning management system where people can study the product they purchased.

So that would be two different wordpress databases.

I am trying to get a general idea of which direction I might wanna head to as I have the following questions:

1) Is it even possible that plugin from one wordpress can communicate with other wordpress database in sub-domain?

2) Is it possible that a wordpress can have two databases and plugin runs from different database?

3) Is there a specific method to exactly diagnose how many plugins activate and know if certain tasks well successfully run without 30 seconds time out issue?

Answer Source

You need to fix the underlying issues in the one WordPress site with the Ecommerce and LearnDash plugins, because 1) and 2) are huge wastes of time that will result in a buggy, unreliable system that will be difficult to maintain.

3) look in your server logs for the PHP timeout and memory errors; adjust PHP memory and time-out issues on your server.

PHP timeout errors:

Set your PHP max_execution_time for 120 seconds in the php.ini file:

max_execution_time = 120

or in .htaccess for PHP5

<IfModule mod_php5.c> php_value max_execution_time 120 </IfModule>


Set WordPress memory in wp-config.php:

Overall memory:

define('WP_MEMORY_LIMIT', '128M');

Memory for admin:

define('WP_MAX_MEMORY_LIMIT', '256M');

If you're on cheap shared hosting, find a better host. Ecommerce and systems such as LearnDash are very database intensive and will not run on a cheap host, even with lots of memory and high PHP execution settings. Having to give PHP more than 30 t0 60 seconds max_execution_time means you are on a slow server.

If this is your own server, use one of many debug plugins to check MySQL query usage, slow queries, etc. Adjust MySQL configurations as needed so MySQL can handle the loads of WordPress and the plugins. If this is not your own server, find a better host.