> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Fixing the "String could not be parsed as XML" PHP error message

> Troubleshoot the "String could not be parsed as XML" error in PHP with step-by-step guidance and code snippets.

This article describes how to troubleshoot the "String could not be parsed as XML" error message in PHP.

## Problem

When you try to parse XML data in a PHP script, you receive the following error message:

```
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in FILENAME on line X
```

## Resolution

The most likely cause of this error is that the XML data you are trying to process is not valid. Alternatively, the XML data may contain non-standard characters or use a different character set encoding.

There are several websites that can validate XML data. For example, the website [http://www.xmlvalidation.com](http://www.xmlvalidation.com) can check basic XML syntax, as well as validate XML data against external schema, such as DTD (Document Type Definition) documents.

## Related articles

* [Viewing PHP settings](/docs/view-php-settings)

* [‘500 Internal Server Error’ while running PHP](/docs/500-internal-server-error-while-running-php)
