Skip Navigation

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
12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 12:00 – 20:00 - -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Noman 6 months, 1 week ago.

Assisted by: Noman.

Author Posts
May 13, 2024 at 3:31 pm #15621674

anneB-6

Every few pages, the website throws a 500 Internal Server Error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

The information in the debug log is as follows:

PHP Warning: preg_replace(): Compilation failed: quantifier does not follow a repeatable item at offset 2 in /html/wordpress/wp-content/plugins/sitepress-multilingual-cms/classes/utilities/class-wpml-slash-management.php on line 118

When I disable WPML the website works fine. Right now, WPML is disabled.

May 13, 2024 at 4:24 pm #15621866

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting WPML Support. Based on the details you provided, it appears that the Internal Server Error issue may be related to specific plugins or themes on your site. To address this, could you please follow the below steps and see if this resolves your issue:

1. Please take a backup of your site first for safety reasons.

2. Please add the below code in the functions.php file of your theme:

add_filter('mod_rewrite_rules', 'fix_rewritebase');
function fix_rewritebase($rules){
    $home_root = parse_url(home_url());
    if ( isset( $home_root['path'] ) ) {
        $home_root = trailingslashit($home_root['path']);
    } else {
        $home_root = '/';
    }
  
    $wpml_root = parse_url(get_option('home'));
    if ( isset( $wpml_root['path'] ) ) {
        $wpml_root = trailingslashit($wpml_root['path']);
    } else {
        $wpml_root = '/';
    }
  
    $rules = str_replace("RewriteBase $home_root", "RewriteBase $wpml_root", $rules);
    $rules = str_replace("RewriteRule . $home_root", "RewriteRule . $wpml_root", $rules);
  
    return $rules;
}

3. Please re-save the permalinks from the Settings >> Permalinks page by pressing the Save Changes button.

4. Please delete all sorts of caches on your site/server cache if any / plugin cache / CDN cache, clear the browser cache, and then see if it resolves the issue afterward.

Here is a doc for more details:
https://wpml.org/faq/why-is-htaccess-getting-overwritten-with-the-language-folder-on-my-wpml-website/

Please let me know the results,
Thank you

May 22, 2024 at 12:02 pm #15657915

anneB-6

Hi Noman,

Thank you for your reply. I have followed the steps outlined in your mail, but the problem with the 500 Internal Server Error persists.

The following errors were found in the debug log:

[22-May-2024 11:30:58 UTC] PHP Warning: Undefined array key 0 in /html/wordpress/wp-content/plugins/wpml-media-translation/classes/class-wpml-media-attachment-by-url-query.php on line 99
[22-May-2024 11:30:58 UTC] PHP Warning: Undefined array key 1 in /html/wordpress/wp-content/plugins/wpml-media-translation/classes/class-wpml-media-attachment-by-url-query.php on line 99
[22-May-2024 11:30:58 UTC] PHP Warning: Undefined array key 0 in /html/wordpress/wp-content/plugins/wpml-media-translation/classes/class-wpml-media-attachment-by-url-query.php on line 163
[22-May-2024 11:30:58 UTC] PHP Warning: Undefined array key 1 in /html/wordpress/wp-content/plugins/wpml-media-translation/classes/class-wpml-media-attachment-by-url-query.php on line 163
[22-May-2024 11:30:58 UTC] PHP Warning: Undefined array key 5 in /html/wordpress/wp-content/plugins/wpml-media-translation/classes/class-wpml-media-attachment-by-url-query.php on line 163
[22-May-2024 11:30:58 UTC] PHP Warning: Undefined array key 7 in /html/wordpress/wp-content/plugins/wpml-media-translation/classes/class-wpml-media-attachment-by-url-query.php on line 163

[22-May-2024 11:31:04 UTC] PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /html/wordpress/wp-includes/functions.php on line 7288
[22-May-2024 11:31:04 UTC] PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /html/wordpress/wp-includes/functions.php on line 2187

[22-May-2024 11:35:59 UTC] PHP Warning: preg_replace(): Compilation failed: quantifier does not follow a repeatable item at offset 2 in /html/wordpress/wp-content/plugins/sitepress-multilingual-cms/classes/utilities/class-wpml-slash-management.php on line 118

I have now deactived WPML and the snippet again.

Sorry that I could not get back to you earlier.

Thanks in advance for your support.

Best regards,

Anne Bremer

May 22, 2024 at 4:04 pm #15659220

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for trying those steps. Could you please follow the below steps and see if this resolves the issue:

1. Please take a backup of your site first for safety reasons.

2. We have recently released WPML 4.6.11, please update it to the latest version. You can update it from Plugins >> Add New page, click the Commercial tab, and then click the “Check for updates” button. Here is the screenshot for more details:
https://wpml.org/wp-content/uploads/2020/04/wpml-force-plugin-update-1.png

3. Please go to WPML >> Support >> Troubleshooting page and press the below buttons:
- Clear the cache in WPML
- [Please choose each post type one by one] Synchronize posts taxonomies
- Remove ghost entries from the translation tables
- Synchronize local job ids with ATE jobs
- Synchronize translators and translation managers with ATE
- Assign translation status to duplicated content
- Fix post type assignment for translations
- Set language information

And see if this resolves the issue.

4. If the issue persists, kindly perform the following steps to isolate the cause of the issue:
- Deactivate all plugins except WPML and it’s add-ons.
- Switch to the parent WordPress theme like 2023.
- If the issue is gone, reactivate each plugin one by one to identify the one causing the issue.

Please let me know the results,
Thank you for your cooperation

The topic ‘[Closed] WPML seems to cause an internal server error: PHP Warning: preg_replace(): Comp’ is closed to new replies.