Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing an issue with automatic string translation in WPML, receiving an error message indicating a problem connecting to automatic translation. Despite confirming that the REST API is enabled and deactivating all other plugins, the issue persists.
Solution:
We recommend checking if the

eval()

function is enabled on your server, as WPML's TWIG framework requires it for template compilation. This function is essential for the operation of many templating engines, including TWIG, which WPML uses. It allows for faster execution through OPcode caching and ensures safe usage with WPML due to extensive checks and sanitation. If

eval()

is disabled, it might be due to extensions like Suhosin, which can be configured by your hosting provider. For more details, please refer to our documentation on minimum requirements: https://wpml.org/home/minimum-requirements/#eval-usage.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket for further assistance at WPML support forum.

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.

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Waqas Bin Hasan 2 years, 11 months ago.

Assisted by: Waqas Bin Hasan.

Author Posts
August 9, 2022 at 8:46 pm #11835957

jasonA-19

Tell us what you are trying to do?
Do automatic string translation

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?
hidden link

I am getting "There is a problem connecting to automatic translation. Please check your internet connection and try again in a few minutes. If you continue to see this message please contact our support team" on the Automatic Translation page.

I know there are a bunch of threads on here about this error, but I have tried all suggested including making sure your domains are not blocked.

I have tried deactivating all other plugins as well. The plugin says the REST api is disabled, but it doesn't seem to be as visiting hidden link works fine.

Please let me know what I need to do! Thanks!

August 10, 2022 at 10:14 am #11839211

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

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

Hi,

Thank you for contacting the support.

This may be a temporary issue or a false-positive. However, are there any security modules installed on your website? Because the server might be blocking some requests. Please have a look at the “WPML plugin cannot connect to wpml.org” section from this article https://wpml.org/faq/troubleshooting-registration/ and make sure that the mentioned elements are whitelisted on your website.

You can also try to force the connection to wpml.org, by going to Plugins > Add new > Commercial tab and click the button "Check for updates".

Also ensure that your production site meets minimum requirements as prescribed at https://wpml.org/faq/checklist-before-opening-a-ticket-in-wpml-support/#does-your-wordpress-installation-afford-you-all-the-resources-needed.

Please let me know if it helps resolve the issue or I'll try my best to help you further assist you on the matter.

Regards.

August 10, 2022 at 1:40 pm #11841913

jasonA-19

Ok, I just confirmed with my hosting company that everything but eval() is enabled on the server. They informed me that eval() CANNOT be enabled on the server.

But we have another site, juanlaw.com, that is also using WPML and has no issues, at least on the front end. For that site I don't even see a tab for Automatic Translations.

Would the lack of eval() cause the automatic translations function not to work?

August 10, 2022 at 2:12 pm #11842341

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

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

Hi,

Thank you for confirming that.

Yes, as per the documentation (https://wpml.org/home/minimum-requirements/#eval-usage) states:

"The eval() function must be enabled because WPML uses TWIG framework for its structure and templates, which makes WPML dependable on this function.

Most popular templating engines, such as Smarty and TWIG, have found that it is faster to write the PHP code to a file. In that way, it can take advantage of the OPcode caching and avoid to require a run-time building of template code.

TWIG runs a lot of checks and sanitation to avoid possible attacks and it is safe to be used with WPML. However, we cannot assure that other developers have made the same checks we did in our Quality Assurance process.

We are still investigating possible solutions which do not require compiling templates on the fly and would make the use of the eval() function unnecessary. However, at the moment, this is the best solution.

Please note that usually, the eval() function cannot be disabled in PHP, but some extensions such as Suhosin can do that. These extensions might be installed and configured by your hosting provider."

Regards.