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
- - 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00
- - - - - - -

Supporter timezone: America/Lima (GMT-05:00)

This topic contains 9 replies, has 3 voices.

Last updated by Andreas W. 6 months ago.

Assisted by: Andreas W..

Author Posts
July 26, 2024 at 1:10 pm #16008833

pawelM-9

Background of the issue:
I am trying to resolve an issue with WPML AJAX switching_language on my site hidden link. I followed the steps from the thread https://wpml.org/forums/topic/wpml-ajax-switching_language/ but the problem persists. Additionally, I encountered the following error: [26-Jul-2024 12:54:34 UTC] PHP Fatal error: Uncaught TypeError: mysqli::real_connect(): Argument #5 ($port) must be of type ?int, string given in /home/rainbowc/public_html/wp-includes/class-wpdb.php:2344 Stack trace: #0 [internal function]: mysqli->real_connect('localhost', 'XXXX', 'ZZZ...', 'XXXX', '') #1 /home/rainbowc/public_html/wp-includes/class-wpdb.php(2344): mysqli_query(Object(mysqli), 'SELECT SQL_CALC...') #2 /home/rainbowc/public_html/wp-includes/class-wpdb.php(2258): wpdb->_do_query('SELECT SQL_CALC...') #3 /home/rainbowc/public_html/wp-includes/class-wpdb.php(3141): wpdb->query('SELECT SQL_CALC...') #4 /home/rainbowc/public_html/wp-content/plugins/wpml-string-translation/classes/class-wpml-st-strings.php(264): wpdb->get_results('SELECT SQL_CALC...', 'ARRAY_A') #5 /home/rainbowc/public_html/wp-content/plugins/wpml-string-translation/classes/class-wpml-st-strings.php(102): WPML_ST_Strings->get_results(' WHERE 1 AND i...', '', 0, '100', Array) #6 /home/rainbowc/public_html/wp-content/plugins/wpml-string-translation/inc/functions.php(614): WPML_ST_Strings->get_string_translations() #7 /home/rainbowc/public_html/wp-content/plugins/wpml-string-translation/menu/string-translation.php(299): icl_get_string_translations() #8 /home/rainbowc/public_html/wp-admin/admin.php(293): include('/home/rainbowc/...') #9 {main} thrown in /home/rainbowc/public_html/wp-includes/class-wpdb.php on line 2344

Symptoms:
The problem with WPML AJAX switching_language persists and a PHP Fatal error occurred: Uncaught TypeError: mysqli::real_connect(): Argument #5 ($port) must be of type ?int, string given.

Questions:
How can I resolve the WPML AJAX switching_language issue?
What steps should I take to fix the PHP Fatal error related to mysqli::real_connect()?

July 30, 2024 at 4:45 pm #16021667

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hello,

Do you possibly have a staging environment where I could take a closer look at this in isolation?

Best regards,
Marcel

July 31, 2024 at 4:06 pm #16026463

Marcel
Supporter

Languages: English (English ) German (Deutsch )

Timezone: Europe/Madrid (GMT+01:00)

Hi,

Could you please verify the FTP credentials? I'm experiencing a timeout, which is preventing me from checking the logs. Thank you!

Best Regards,
Marcel

August 7, 2024 at 9:11 am #16046941

pawelM-9

I have already sent this data and cannot send it again:

ERROR: Duplicate reply detected; it looks as though you’ve already said that!

August 8, 2024 at 12:14 am #16050141

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

My colleague Marcel is on vacation, which is why I am assisting you on this matter.

Thank you for the provided test site.

Take note, that your site uses different domains per language which is something that I can not test on this test site.

The language redirect works as expected when using "Different language in directories."

Could you please set up at least one test domain for this test site inside the DNS settings of your server, so that we can run further tests? This can be a subdomain.

Best regards
Andreas

August 12, 2024 at 6:34 pm #16063577

pawelM-9

I added the domain to the hosting configuration: rainb2.jdmsite.com

August 13, 2024 at 4:59 pm #16067598

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

I do not see an issue at the moment by visiting the homepage and switching to another language.

Could you please name me an exact example?

August 19, 2024 at 3:19 pm #16084551

pawelM-9

have configured the domains as follows:

English: hidden link
Polish: hidden link

I haven't set up the rest of the languages yet. However, when I switch languages, there is still a significant delay. Could you please assist with this issue?

Thank you in advance.

August 20, 2024 at 7:14 pm #16088139

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Before taking a look into the issue, please make sure to always update the theme and any additional plugins.

WP DEBUG was enabled during my test on the staging site, to check if I can still catch the error that you have been reporting.

The only thing found inside the debug.log is:

PHP Deprecated:  Function woocommerce_get_page_id is <strong>deprecated</strong> since version 3.0! Use wc_get_page_id instead. in /home/ubfkbbfm/public_html/wp-includes/functions.php on line 6085

I can not confirm the reported error any longer on the staging site.

Regaring performance:

Also, take note that a dashboard notification is asking to sync product category hierarchies.

It looks like those steps already lead to 1-2 seconds less in load time.

Next, I went to WPML > Support > Troubleshooting and ran the available options inside the section "Cleanup" and the option to "ceanup and optimize string tables".

Further, I went to WPML > Theme & Plugin Localization where in the top section of the page the following banner showed up:

"WPML has detected changed or new MO files"

I opened the banner, marked all the checkboxes and clicked "Scan translation files". This will created custom language files for WPML and enhance the the site's performance.

You might need to run this dialog a couple of times, as there are 4687 than need to get created.

In case you run into issue that this dialog willnot complete, please verify if you are running out of server space. Low server capacity further can impcact the performance as well.

Take note, that a site with 22 active languages needs sufficient resource in server CPU as well.

Further, the more plugins are enabled on the site, the longer the load time will be.

I will keep investigating on this matter on the staging site, to see if I can find something else that might be causing issue.

August 20, 2024 at 11:02 pm #16088455

Andreas W.
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

If you currenlty take a look at the staging site, you will see that the Polish translation of your homepage loads within 3 seconds.

It remains the following notification, which refers to WooCommerce:

Function woocommerce_get_page_id is deprecated since version 3.0! Use wc_get_page_id instead.	
wc_deprecated_function()
Plugin: woocommerce

Take note, that here are all premium plugins disabled, for which I could not run the available updates. Also, the theme and other premium plugins are not registered, for which for example it is not possible to use the theme options.

It would be great if you could run all the available updates and register the theme and other plugins, of possible, and I can then offer to run a further test on this staging.

The topic ‘[Closed] WPML AJAX switching_language’ is closed to new replies.