Broken blog due a blank space charactere!

If this article is useful for you, please, consider to retribute. Thanks

brokenilucatojpg

Phew what a scare! Today I got a blog error and it didn’t want to fix. It messed all layout in the front-end and back-end. I will share the information with you guys, just in case somebody else has fallen in the same problem, so you can fix it before despair or restore a very old back-up.

After adjusting some stuffs here and there, suddenly appeared the error message below. Wow! Got scared! Messed the site layout from front-end to the back and and nothing to get back to the normal. So, keep calm, don’t panic. A simple blank space that maybe you’ve typed might have caused this problem. Here is the error message:

Warning: Cannot modify header information – headers already sent by (output started at /mywordpress/wp-includes/firstfile.php:2795) in /mywordpress/wp-content/plugins/pluginxyz/otherfile.php on line 243

In the error message above, read and undertend that the problem is at the line #2795 in the firstfile.php and not in the otherfile.php at the line 243.

Usually this error is caused due a blank space typed by mistake and it ends up treating the file as HTML instead of PHP and cause this error. So, you may check in the file problematic file if there is/are some caracters before the opening PHP command <?php or after the closing PHP command ?>.

Knowing that, I’ve edited my php file (Notepad, BBEdit ou CodeLobster ), in this my example the file was “firstfile.php”. I went to the line 2795 and over there I’ve deleted (backspace) all characters until get to the closed php command ?> and nothing else left after that. I saved the file, uploaded to the server and the problem is gone! In other words, as I’ve said previously, you can not leave any extra character, even if is just blank space, before and/or after the commands that open and close the PHP code (<?php     ?> ).

Some tips on the Internet may say to save the  wp-config.php as ANSI type, but the problem is if your language uses accentuation (special characters), it may be saved as UTF-8, otherwise it will mess the characters if the code has some stuff to show on-line (front-end). Ah! Besides that, don’t forget to check what is really the right name of the problematic file as I’ve shown in the sample above. I hope that helps

Good luck!

If you think that some article from iLucato was useful, help ilucato by contributing here with the amount you think is fair for the help you have received and incentive to create more videos and articles. Thanks in advance..

Filed Under: CMSTips & TricksiLucatoWordPress

Tags:

My latest images for sale at Shutterstock:








RSSComments (0)

Trackback URL

Leave a Reply

notify me when a reply is posted.