Tell us what you are trying to do?
I added wpml to an existing website. Now back-end pages sometimes give a random internal server error (500) when loading. There is no reliable way to force or avoid this error. When disabling the wpml plugin again the 500 error never occurs. I have my debug logs enabled but there are no error logs showing up when the internal server error occurs. My WP_MEMORY_LIMIT is set to 512M.
Thank you for contacting WPML Support, I will be happy to help you today.
This this issue is not caused by WPML, it actually comes from certain third-party plugins calling flush_rewrite_rules(true) function too often. This causes WordPress to overwrite .htaccess.
I tried following your instructions but unfortunately this did not resolve my issue.
I've checked what plugins I have use this flush_rewrite_rules function and found the following on my website:
ACF-pro
Custom-post-type-ui
Woocommerce
Woocommerce-multilingual (wpml)
Yoast SEO
wpml-string-translation
1) To find if the issue is due to a plugin conflict please follow the below troubleshooting steps:
- set a default WP theme
- keep active only WPML and WCML Plugins
- disable all other plugins
After, check if the issue is still happening. If the issue disappears, enable the plugins one by one to isolate the conflicting plugin.
* I suggest you try this in a staging/dev site to avoid any possible live site compromising issues.
Note: Please make sure you have a full backup (files & database) before trying anything on your website.
2) Please set up the debug.log configuration as suggested below (if your setup is different) and provide me the WordPress debug.log file content (if anything is registered).
To enable debug.log, open your wp-config.php file and look for:
define('WP_DEBUG', false);
And change it to:
define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings which is recommended on a live site.
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);
Then try to reproduce the issue and check if any errors were saved to the debug.log log file inside the “.../wp-content/” directory.
If you can paste your debug.log to https://pastebin.com/ and provide me with that link, it would be great!
1)
I followed your steps and activated a default theme (twenty-one) in a staging environment.
I disabled all plugins besides the wpml ones which seemed to avoid the error. I than proceeded to turn the other plugins on one by one and tested rigorously after each one. After some time the error occurred again so I disabled the last plugin I've turned on, and continued with the others. However now the problem seemed to come back with almost every additional plugin I turned on (even if the plugin does not contain the flush_rewrite_rules() function). I than disabled all plugins again besides wpml, and turned on just the first one that caused the issue only to find out that now there is no issue. It seems that the issue only occurs rarely when I turn on a few more plugins (no matter which ones!). And it occurs more often the more plugins I enable. This made me think that it could be a memory issue but this seems odd as my WP_MEMORY_LIMIT is set to 512M. And if I turn on all plugins besides the WPML plugins the issue is gone. As soon as I turn wpml on and try a different selection of plugins every time, the issue always comes back, never pointing to one other plugin particularly. This makes me think the issue is related to wpml.
2)
As I told you in my first message. I have my debug logs enabled but there are unfortunately no error logs showing up when the internal server error occurs. I know they would work as I can print logs with error_log().
It is strange that no log is showing on the debug.log file as normally those kind of errors should show up, please try contacting the hosting support team so they can check if there is any server log regarding the error you are having.
What I would suggest at this point is:
1) Try to increase the WP_MEMORY_LIMIT (I would say double it so you be sure it is enough), and see if the issue is still happening
2) If you have any plugins outdated I would suggest also updating them
Did you apply what was suggested from the errata on the staging site as well?