This page contains the following errors

New Page

XML Parse Error: This page contains the following errors

Warning: There is no legacy documentation available for this item, so you are consulting the current documentation.

This page contains the following errors:

error line 1 column 6: XML declaration authorized only at the beginning of the document

Below is a rendering of the page up to the first error.

That is

XML parse error: XML or text declaration not at start of entity

XML declaration error in XML sitemap XML declaration error in XML sitemap

As frustrating as this may sound, unfortunately this is not something that can be “fixed” in All in One SEO, and requires troubleshooting to determine which file is causing it.

If you get this error, it indicates that the headers have already been sent, usually because of another PHP file showing blank lines. Typically, this happens when a poorly written plugin or theme PHP file incorrectly generates a closing PHP ?> tag, followed by a few extra lines.

There are three possible culprits:

  1. Other plugin – You can use these instructions to minimize the offending plugin(s). Once you find the plugin, you can disable it, search for files with a closing PHP tag followed by blank lines and delete it, or contact the developer with the bug report.
  2. Its subject : similar to n. #2, use these instructions to determine if the problem is your problem. Install a fresh, unmodified copy of one of the default themes (Twenty Nineteen, Twenty Twenty, etc.). If the problem goes away, you know it was your problem.
  3. WordPress Core – This would only be a problem if you have a very old version of WP (upgrade!) or have modified the core files (don’t!).

White space after closing PHP tag White space after the closing PHP tag

Wherever you find this closing PHP tag, remove it.

This page contains the following error: error at line 1 in column 1: the document is empty

Ask

Asked 6 years, 5 months ago

Edited 4 months ago

Seen 35k times

Report this ad

This question shows research effort; it is useful and clear

3

This question shows no research effort; it’s not clear or not helpful

0

Bookmark this question.

View activity on this post.

I can’t find the solution, please help me. below is the code. Thanks in advance

<?php require_once(‘connect.php’); $sql = “select * from project”; $result = $conn->query($sql); $xml = new SimpleXMLElement(‘<xml/>’); if ($result->num_rows > 0) { // display the data for each row while($row = $result->fetch_assoc()) { $mydata = $xml->addChild(‘mydata’); $mydata->addChild(‘Id’,$row[‘idProject’]); } } else { echo “0 results”; } $conn->close(); header(“Content-Type:text/xml”); echo($xml->asXML()); ?>

and the connect.php file

$servername = “localhost”; $username = “root”; $password = “”; $dbname = “mtocrowdrise”; // Create a connection $conn = new mysqli($servername, $username, $password, $dbname); // Check the connection if ($conn->connect_error) { die(“Connection failed: ” . $conn->connect_error); } echo “connected successfully”;

Meanwhile, I always get this error:

This page contains the following errors: error on line 1 in column 1: The document is empty Below is a rendering of the page up to the first error.

  • php
  • XML
  • lwuit

compare

Share a link to this question

Copy link CC BY-SA 3.0

Improve this question

Follow

Follow this question to receive notifications

asked on April 20, 2016 at 2:52 PM

Avatar of Firas Chebbah

Firas Chebbah Firas Chebbah

409 2 2 gold badges 10 10 silver badges 24 24 bronze badges

of them

  • Remove echo “connected successfully”; from connect.php. You shouldn’t be writing/outputting any HTML to the page when said page is being cast as na XML Document (header (“Content-Type:text/xml”);). You’ll also (eventually) get the same error if } else { echo “0 results”; satisfied. So you should only cast the document to XML if there are no errors and there is actually some XML to display.

    – mferly

    Apr 20, 2016 at 2:55 pm

  • perfect thanks @Marcus

    – Firas Chebbah

    Apr 20, 2016 at 2:59 pm

Add a comment | 

1 Answer 1

Sorted by: Reset to default

Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first)

This answer is useful

3

This answer is not useful

Show activity on this post.

You should not write/display any HTML code on the page when said page is converted to an XML document (header (“Content-Type:text/xml”);).

Remove echo “successfully connected”; from connect.php.

You will also (possibly) get the same error if:

… } else { echo “0 results”; } … header(“Content-Type:text/xml”);

satisfied. So you should only cast the document to XML if there are no errors and there is actually XML to display.

Something like the following would only set the document to XML if there are results to display (according to your original code):

require_once(‘connect.php’); $sql = “select * from project”; $result = $conn->query($sql); if ($result->num_rows > 0) { $xml = new SimpleXMLElement(‘<xml/>’); // display the data of each row while($row = $result->fetch_assoc()) { $mydata = $xml->addChild(‘mydata’); $mydata->addChild(‘Id’,$row[‘idProject’]); } header(“Content-Type:text/xml”); echo($xml->asXML()); } else { echo “0 results”; } $conn->close();

compare

Share a link to this answer

Copy link CC BY-SA 3.0

Improve this answer

Follow

Follow this answer to receive notifications

answered on April 20, 2016 at 3:02 PM

mferly user avatar

mferly mferly

1,646 1 1 gold badge 13 13 silver badges 19 19 bronze badges

Add a comment | 

Your answer

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid…

  • Ask for help, clarification, or respond to other responses.
  • Make statements based on opinion; back them up with references or personal experience.

To learn more, check out our tips for writing great responses.

saved draft

Draft rejected

Sign up or log in

Sign up with Google

Sign up using Facebook

Sign up using your email and password

Submit

Post as guest

Yam

E-mail

Required, but never displayed

Post as guest

Yam

E-mail

Required, but never displayed

Post your answer Ignore

By clicking “Post your answer” you agree to our Terms of Service, Privacy Policy and Cookies Policy

Not the answer you are looking for? Browse other tagged questions

  • php
  • XML
  • lwuit

or ask your own question.

  • The overflow blog
  • Five Nines Uptime Without Developer Attrition (Ep. 488)

  • We Hate Scrum and Agile… When Done Badly (Ep. 489)

  • Featured in Meta
  • Recent color contrast changes and accessibility updates

  • Do I need to explain other people’s answers in code?

  • Reviewer overboard! Or a request to improve the onboarding guide for new…

  • Collective update: recognized members, articles and GitLab

Leap

0

Error at line 1 in column 1; Is the document empty?

Related

6

This page contains the following errors: error on line 1 at column 1: The document is empty

1

Can’t count records in incoming PHP result set to SQL database?

burning questions from the net

  • Question on the definition of a homomorphism
  • What license can protect the owner of a project and give ownership of voluntary contributions?
  • What is the smell after rubbing the quartz?
  • ¿Creía la iglesia primitiva que Jesús fue crucificado en una cruz o en un madero?
  • ¿La clave en la que está escrita una pieza afecta la ability de interpretation del piano?
  • Encontrar la participation y el device de bloc para un sistema de archivos *sin* manipulación de padlock
  • ¿Qué tan important es tener muchas marches en una bicicleta eléctrica?
  • ¿Puede el Congreso hacer cumplir una decisión revocada de la Corte Suprema?
  • ¿Cómo los lentes de contacto recetados para criaturas evitan que un actor se caiga al suelo mientras corre?
  • ¿Cómo hacer que un NPC intimide al grupo de forma más efectiva?
  • ¿Cómo funcionan los multímetros?
  • Lista enlazada unidireccional en C
  • Cómo obtener un elemento de la lista
  • ¿Qué es la estrella naranja brillante?
  • ¿Permutación similar a una antorcha para arreglos?
  • Tipo de homotopía de Diff(ℝP³)
  • Python decibelios con precisión de metro?
  • ¿Qué videojuego se está jugando en Spiderhead (2022)?
  • ¿Cuál es el número mínimo de líneas para garantizar que haya al menos un ángulo de menos de 26 grados (Las aplicaciones del principio del casillero)
  • ¿La minimización de una función estrictamente convexa sigue siendo estrictamente convexa?
  • El restaurante de Alice se beneficia de las personas con alergias
  • Cambio de un tubo de teflón dentro de un hotend, ayuda con el desmontaje
  • ¿DNDBeyond es correcto en la bonificación de guardabosques?
  • ¿Cómo deshacerse de una gran cantidad de azúcar húmedo?

Feed de preguntas

Suscríbete a RSS

Feed de preguntas

Para suscribirse a esta fuente RSS, copie y pegue esta URL en su lector de RSS.

Support » Plugin: All in One SEO – Best WordPress SEO Plugin – Easily Improve SEO Rankings & Increase Traffic » This page contains the following errors:

Esta página contiene los siguientes errores:

  • Resolved d6cc17d3b7995163cd4aa27b4140b987cdhodgdon

    (@cdhodgdon)

    2 years, 4 months ago

    My sitemap is not working, I get the following error on the xml page

    “This page contains the following errors: error on line 2 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error.”

    I know this has to do with a blank or “white” line at the top of the page, so when I right click the xml page and view source I can see line 1 is blank. I have checked my functions.php and wp-config.php file to be sure they did not have any closing php brackets and no extra spots and they don’t. I have tested by turning off all the plugins and changing to the default template and its made no change.

    I have not uninstalled and reinstalled AINSEO, as I am not sure if it will remove all the custom SEO items I have put in for my pages and posts.

    I am currently downloading a copy of the site to place on a different server to see if I can replicate the issue. But the funny thing is that I migrated this site from another server (which still has the development site on it), and I added a fresh copy of AIOSEO to it, since I did not have it installed during development and it worked just fine even with having twice as many plugins in the wordpress installation and such.

    Would love any suggestions on this problem. Thanks

    The page I need help with: [log in to see the link]

Viendo 7 respuestas – 1 a 7 (de 7 en total)

  • Plugin Support 06f09e7e3a97a6af2ccd5119aafccc53Steve M

    (@wpsmort)

    2 years, 4 months ago

    @cdhodgdon The blank space or line can be in any file within your WordPress install which is what makes this difficult to troubleshoot. If you’ve eliminated all plugins and your theme then reinstall WordPress and see if that fixes it.

    All your settings and SEO data are stored in the WordPress database so you can safely deactivate and delete All in One SEO and you won’t loose your settings or SEO. Just make sure to take a backup of your database when doing anything on your site.

    Thread Starter d6cc17d3b7995163cd4aa27b4140b987cdhodgdon

    (@cdhodgdon)

    2 years, 4 months ago

    @wpsmort

    Ok, I will remove the AINSEO then reinstall WordPress itself again (did it while I still have AINSEO on the site) and then reinstall it and see what happens. If there any way to search for an extra line or php ?> in a file. I am also getting ready to upload a copy of the entire site, using All-In-One Migrator to a different server and see what happens.

    J’avais le site de développement sur un service différent, où il se trouve toujours, et j’ai installé AINSEO sur cette copie du site et cela semblait fonctionner correctement. Je fais donc la même chose à l’envers en ce moment, en le retirant du serveur de production et en le clonant sur mon serveur de développement séparé et voir si la nouvelle version a le problème là-bas. Si cela fonctionne, cela signifierait que quelque chose sur le serveur de production est détraqué. Si tel est le cas, quelle pourrait être la cause d’un serveur lui-même ?

    Prise en charge des plugins 06f09e7e3a97a6af2ccd5119aafccc53Steve M

    (@wpsmort)

    il y a 2 ans, 4 mois

    Malheureusement, je ne connais aucun moyen de rechercher tous les fichiers PHP pour trouver un espace ou une ligne vide. Il vous suffit de passer par un processus méthodique d’élimination.

    Author of the plugin 655ba73db8e50e3c36d38e68bb65b46carnaudbroes

    (@arnaudbroes)

    2 years, 4 months ago

    We have a document about it here – https://semperplugins.com/documentation/this-page-contains-the-following-errors/.

    If reinstalling WordPress doesn’t help, I recommend disabling all other plugins, switching to the default theme, and then re-enabling them one at a time to see if you can track down the culprit.

    d6cc17d3b7995163cd4aa27b4140b987Thread author

    (@cdhodgdon)

    2 years, 4 months ago

    OK. Any idea on a possible server problem, if the pages are clean? I still use FTP for cloning, the bad part of living in a small rural town, so I couldn’t test the official site on the other server to see if it still happens.

    d6cc17d3b7995163cd4aa27b4140b987Thread author

    (@cdhodgdon)

    2 years, 4 months ago

    @wpsmort

    I uploaded to my dev server and everything worked as it should, so it must be something in the server settings. Ideas?

    @arnaudbroes

    I’ve done this before, a fresh install of WordPress, disabling plugins and even deleting them, the default template used, if with a brand new install of WP and a fresh install of AIOSEO with nothing else, this always did the same thing.

    I cloned the site to a different server at a different hosting location (different data center) and it worked fine so it seems like something with server configuration, any idea what to look for ?

    06f09e7e3a97a6af2ccd5119aafccc53Steve M plugin support

    (@wpsmort)

    2 years, 4 months ago

    @cdhodgdon No idea what could be causing this on your server. We only know that this is caused by empty spaces in PHP files.

Showing 7 answers – 1 to 7 (of 7 total)

  • The topic ‘This page contains the following errors:’ is closed and does not allow any more replies.


Video This page contains the following errors

Related Posts

Free chat room code for my website

Contents1 How to set up a free chat room on the website.2 3 comentarios2.1 Trackbacks/Pingbacks2.2 Submit a Comment Cancel reply3 How to Create a Chat Room Website…

Background image full screen css

Contents1 Cómo – Full Page Image1.1 Example1.2 Example2 CSS background image tamaño tutorial: how to codify a complete page background image3 Perfect Full Page Background Image3.1 Méthode CSS géniale,…

WordPress leverage browser caching

Contents1 Aproveche el almacenamiento in hidden del navegador1.1 Will it works for my website?1.2 Where are plugin options1.3 Some JavaScript files still display under Leverage Browser Caching1.4…

WordPress post to facebook page

Contents1 How to Automatically Post to Facebook from WordPress1.1 Download Now: How to Launch a WordPress Website [Free Guide + Checklist]1.2 1. Create an IFTTT account.1.3 2….

Download images from wordpress media library

Contents1 How to export your WordPress media library1.1 Download maintenant : How to launch a WordPress website [Free Guide + Checklist]1.2 How to export your WordPress media…

WordPress single post template

Contents1 How to Create Custom Unique Post Templates in WordPress2 Post Template Files2.1 author.php2.2 Fecha.php3 Handbook navigation4 How to Create Custom Single Post Templates in WordPress5 Video…