Skip Navigation

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

Problem:
The client is experiencing a recurring error indicating that the 'DOMDocument' class cannot be found, which is essential for parsing XML in PHP. This error occurs on their WordPress site with WPML installed, and it happens unexpectedly in the early morning when no one is working on the site. Additionally, there is an error on the shop page when switching currency with the WPML multicurrency switcher, and a message in the WPML support error logs about a change in the site's URL.

Solution:
If you're experiencing a similar issue where the 'DOMDocument' class cannot be found, we recommend ensuring that the 'php-xml' extension is installed and enabled in your PHP configuration. This extension is necessary for WPML to function correctly as it relies on XML parsing. You may need to contact your hosting provider or refer to your server's documentation to install or enable PHP extensions.

To enable the 'php-xml' extension on an Apache server, you typically need to install it via your server's package manager and then enable it in your PHP configuration. The installation commands will vary depending on your server's operating system and PHP version. For Ubuntu/Debian, you might use

sudo apt-get install php-xml

, or for CentOS/RHEL,

sudo yum install php-xml

. After installation, remember to restart Apache to apply the changes. If you're unsure about how to proceed, it's best to consult your server's documentation or contact your hosting provider for assistance.

Please note that the solution provided might be irrelevant if it's outdated or not applicable to your case. If the issue persists, 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 you still need help, please open a new support ticket with us.

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.

This topic contains 1 reply, has 2 voices.

Last updated by Bruno Kos 1 year, 4 months ago.

Assisted by: Bruno Kos.

Author Posts
February 7, 2024 at 9:42 am #15275645

vedranV

Hello second time in two days same erorr occured:
- i solved it by switching to php version in cpanel to older than erorr occured on 7.4 than back on 8.0 and it s working, dom is activated on cpanel, do i need to inlude it in php.ini. But client dont want to this happen again and want solution for this is something wpml related:

Info of configuration
WordPress inačica: 6.4.3
Active theme: Goya Child Theme (inačica 1.0)
Trenutni dodatak: WPML Multilingual CMS (inačica 4.6.9)
PHP inačica: 8.0.30

1. Here is the info of erorr down it is related with dom but dom is activated before an erorr occured, this error happens suddenly in early morning nobody is working on site in admin or editing something and we dont want this happen again (it is second time):

Greška vrste E_ERROR je prouzročena u retku 67 datoteke /home/mostarin/public_html/ardiaba/ardiawebnew/wp-content/plugins/sitepress-multilingual-cms/classes/xml-config/class-wpml-xml-config-validate.php. Poruka greške: Uncaught Error: Class "DOMDocument" not found in /home/mostarin/public_html/ardiaba/ardiawebnew/wp-content/plugins/sitepress-multilingual-cms/classes/xml-config/class-wpml-xml-config-validate.php:67
Stack trace:
#0 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-content/plugins/sitepress-multilingual-cms/classes/xml-config/class-wpml-xml-config-validate.php(51): WPML_XML_Config_Validate->get_xml()
#1 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-content/plugins/sitepress-multilingual-cms/classes/xml-config/class-wpml-xml-config-validate.php(34): WPML_XML_Config_Validate->from_string()
#2 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-content/plugins/sitepress-multilingual-cms/classes/xml-config/read/class-wpml-xml-config-read-file.php(18): WPML_XML_Config_Validate->from_file()
#3 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-content/plugins/sitepress-multilingual-cms/classes/xml-config/class-wpml-config.php(306): WPML_XML_Config_Read_File->get()
#4 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-content/plugins/sitepress-multilingual-cms/classes/xml-config/class-wpml-config.php(43): WPML_Config::parse_wpml_config_files()
#5 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-content/plugins/sitepress-multilingual-cms/classes/xml-config/class-wpml-config.php(34): WPML_Config::load_config_run()
#6 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-content/plugins/sitepress-multilingual-cms/inc/translation-management/translation-management.class.php(258): WPML_Config::load_config()
#7 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-includes/class-wp-hook.php(324): TranslationManagement->init()
#8 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#9 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-includes/plugin.php(517): WP_Hook->do_action()
#10 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-settings.php(643): do_action()
#11 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-config.php(98): require_once('/home/mostarin/...')
#12 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-load.php(50): require_once('/home/mostarin/...')
#13 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-admin/admin.php(34): require_once('/home/mostarin/...')
#14 /home/mostarin/public_html/ardiaba/ardiawebnew/wp-admin/plugins.php(10): require_once('/home/mostarin/...')
#15 {main}
  thrown

Tell me what to do with this. nobody wants this to happen again!!!

2. ERORR occured on shop page when switching currency with wpml multicurrency switcher from BAM to USD or to EUR on frontend.

This is the only related support entry https://wpml.org/forums/topic/error-in-your-sql-syntax-get_product_custom_prices/
The error is triggered in the function get_product_custom_prices() from WooCommerce Multilingual and it seems to be relate to get_post_meta.

Here is the erorr that occured when switching currency.

SELECT post_id, meta_key, meta_value
FROM wp_postmeta
WHERE meta_key IN ('_price', '_regular_price', '_sale_price', '_price_EUR', '_regular_price_EUR', '_sale_price_EUR')
AND post_id IN ()	
WCML_Custom_Prices->get_product_custom_prices()
Plugin: woocommerce-multilingual	You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 3	1064

3. What does this mean i found this in dashboard -> wpml -> support -> erorr logs, is it something related?

2024/02/07 9:38:05 AM ATE Server Communication WPML has detected a change in your site's URL. To continue translating your site, go to your WordPress Dashboard and tell WPML if your site has been moved or copied. 0 0 {"url":"https:\/\/ate.wpml.org\/api\/wpml\/languages\/mappings","requestArgs":{"method":"GET"},"status":426}

Please give me the solution of this erorr everything is updated wp and wpml to the latest version, theme to the latest version, and plugins. website is hidden link but erorrs are not visible because debug is false in wp-config dont want my client see this!

thanks and please give me solution of this things

php ini of ardia to look.png
php 8.0 dom activated- extensions screenshot to look.png
February 8, 2024 at 8:42 am #15280095

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Hi,

Thank you for contacting WPML support!

For our support rules we can handle only one issue at a time (so per ticket, chat), so let me focus on the first issue here.

The error you're encountering indicates that the `DOMDocument` class cannot be found, which is essential for parsing XML in PHP. This issue typically arises because the `php-xml` extension, which includes the `DOMDocument` class, is not installed or enabled on your server. To resolve this error, you should ensure that the `php-xml` extension is installed and enabled in your PHP configuration. You might need to contact your hosting provider or refer to your server's documentation on how to install or enable PHP extensions.

To enable the `php-xml` extension on Apache, you usually need to install it via your server's package manager (like `apt` for Ubuntu/Debian or `yum` for CentOS/RHEL) and then enable it in your PHP configuration. The specific commands depend on your server's operating system and PHP version. Generally, you can install it with a command like `sudo apt-get install php-xml` for Ubuntu/Debian or `sudo yum install php-xml` for CentOS/RHEL. After installation, restart Apache to apply the changes. If you're not sure, consult your server's documentation or contact your hosting provider for assistance.

Regards,
Bruno Kos