Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Tirane (GMT+02:00)

This topic contains 5 replies, has 2 voices.

Last updated by Marsel Nikolli 1 year, 8 months ago.

Assisted by: Marsel Nikolli.

Author Posts
November 19, 2023 at 1:57 pm #14870697

wouterV-32

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.

I'm unsure how to debug this issue.

What is the link to your site?
hidden link

Screenshot 2023-11-19 at 14-51-30 500 Internal Server Error.png
November 20, 2023 at 11:33 am #14875927

Marsel Nikolli

Hi,

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 would suggest you try following the instructions showed in the errata here:
https://wpml.org/errata/htaccess-is-rewritten-with-language-folder/

After that try re-saving the permalinks and see if the issue still happens.

Let me know how it goes.

Kind regards,
Marsel

November 20, 2023 at 9:11 pm #14880833

wouterV-32

Hi Marsel,

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

November 21, 2023 at 9:19 am #14884339

Marsel Nikolli

Hi,

Thank you for the update.

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!

Looking forward to your reply,
Marsel

November 22, 2023 at 2:23 pm #14899073

wouterV-32

Hi,

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().

Do you have any more ideas with this information?

Kind regards

November 22, 2023 at 3:21 pm #14900097

Marsel Nikolli

Hi,

Thank you for the update.

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?

https://wpml.org/errata/htaccess-is-rewritten-with-language-folder/

* If not, please do. The code should remain on the theme's functions.php file.

Let me know how it goes,
Marsel

The topic ‘[Closed] Resolve random internal server errors’ is closed to new replies.