Wordpress - Blank Lines before every <?php - php

I am trying to configure Google Search Console and enable it to read my sites xml.
However, there appear to be 6 blank lines and therefore I get the error below:
This page contains the following errors:
error on line 7 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.
Upon inspection of my wordpress theme files, pretty much all of them seem to have 6 blank lines before the php opening <?php
I have no idea what is causing this. I am not an expert at php so please be aware. Just trying to configure my site for google really.
All help will be much appreciated.

Related

Prestashop 1.7 Transplant a Module Page Temporarily Unavailable Error

I recently started experiencing a strange error every single time I try to visit the transplant a module page. From the design > positions page3 I click on the "transplant a module" button on the top right and it takes a really long time to load, but then it does not load at all. I get a blank page with the following error:
The page you are looking for is temporarily unavailable.
Please try again later.
5cb0af3eb5bd6096ecb4dce014d6635a 3a1c22abc23c754c0fb7be3b7c58431e 159cf03490b9d26b556696ed897a7daa
I contacted my server provider and they explained to me that the server I was using was reaching the max amount of files allocated, and that I needed to get a new server just for this particular site. So I did. I then cloned the site and database and brought it over to the new server....but I'm still getting this error everytime I try to transplant a module.
Any one ever encountered this issue? Any one have any ideas as to what could be causing this? Any suggestions on what I can do to troubleshoot this error further?
I have turned on debug mode, and it does not give any more information than what's above.
Thank you all,
Maybe you are facing the following known bug. It will be fixed in 1.7.5 (coming soon)
https://github.com/PrestaShop/PrestaShop/issues/10811
Sometimes module have some issues, I've a problem one day and this help me :
In config/xml copy the 2 files "must_have_modules_list.xml" and "default_country_modules_list.xml" on your PC in case,
And then delete the two files from your site,
This "refresh" the cache of your module config
Hope will help you
The "Transplant a module" page is now working after I changed the file AdminModulesPositionsController.php in /root/controllers/admin folder.
In line 449 changed:
$all_modules_controllers = Dispatcher::getModuleControllers($type);
to
$all_modules_controllers = Dispatcher::getControllers($type);
Try this, it's working for me.

XML Parsing Error: xml processing instruction not at start of external entity

I have a vBulletin 3.8 forum.
When we click Edit button of any post (so the Quick Edit form should displayed), I get this error on the browser's console:
XML Parsing Error: xml processing instruction not at start of external entity
Location: http://www.xxxxx.xx/ajax.php?do=quickedit&p=438
Row number 2, Column 1:
... the Quick Edit form is not appearing the the progress bar displayed permanently.
I have try to disable hooks/ plugins, but the problem still appears.
I have this row on config.php: ini_set("display_errors", false); so I don't think it is a fatal error/ warning by PHP which brokes the xml normal syntax.
I have informed that this appear starts after the move of the site to another server. Does it say something to you?
Any general idea about this error?
EDIT:
Well, I found the reason of this issue, but I don't know how to fix it. Exact the same site on a localhost testing board works perfectly, but on the live server ANY html page/ ajax call etc, has a useless empty line as line #1.
For normal html pages, there is no reason for the browser to return an error, but when we're talking about an ajax call, this empty line at the top of the response, breaks the xml parsing from the browser. So it seems it is a server/ PHP/ Apache setting that applies this empty line. Any idea how to fix it? https://imgur.com/a/4neb0
It might be late for you but any new comers with php/nginx/apache can get an understanding of why.
Answer is simple: When moving the code, you might not be using git/rsync/scp but let me guess, you used zip (and probably Windows/Linux involved).
How to discover it was a two-day journey with many things tried:
We have the same error, we were also moving our servers. We tried:
We thought the server software version was a problem.
We thought the cloud provider OS image was a problem.
We used docker to avoid these problems, but the empty line problem persists.
We thought the code ?> ending was a problem, I went through all of them. But it wasn't.
I finally asked my colleague: How did you get the code? From Git? He said he downloaded from ZIP and then uploaded to server.
I removed code on the server (which extracted from a zip) and used git to download a fresh copy from our github.
Magic, problem solved. The empty line gone.
So I think the problem is with the zipping progress might have changed some file empty lines. Always use git.

Uploading an Article to Joomla 3.6 using a PHP Script

For the past years we have used a local application that uploads articles to our Joomla homepage (Using a PHP Script). After the latest update to Joomla 3.6 (Used to be 3.5) that application no longer works. The following error occurs:
Error displaying the error page: Application Instantiation Error: Failed to start the session because headers have already been sent by "/var/www/DOMAIN/htdocs/FOLDER/execute.php" at line 1.
There used to be an "application.php" file inside ./htdocs/FOLDER/administrator/includes/ and after the update the file disappeared. It looks like the script can't create an instance of the application. I have already tried to repair the Database using the Back End option, but that didn't solve the problem.
Update: The above error occurs at:
$mainframe = JFactory::getApplication('administrator');
Help is much appreciated!
Some text is being output by "/var/www/DOMAIN/htdocs/FOLDER/execute.php", probably white space at line one. Check nothing is output before sending any headers.
Not a great resolution but you could also clean the output buffer before the header fn. Have a read of ob_clean()

PHP error after new install of xampp

I was recently switched computers at work, and am trying to get all my projects up and running again. I am working on testing some php/html/javascript pages for a website using a local xampp server. I had everything working properly on the only computer, but when I try to load the pages now I get the following error:
Uncaught SyntaxError: Unexpected token <
I have tried a php-only test page, so I know the sever is capable of parsing php.
I also know it is not the short tag issue, as all of the php code is wrapped in
<?php...?>
Are there any other configuration settings that would be causing this issue?
The error message doesn't look like a PHP error. Check this discussion maybe you can find the solution there.
It seems the error is reported by Google Chrome when it expects to parse a .js file and it finds HTML (or PHP?) instead.
I think it is a JavaScript error, you should check your js code, not php.
The following reasons might cause this error:
href attribute value "javascript: void ()", no brackets add "0"
Button // error
Button // correct
Non-compliant JSON string
etc.

Issues on eclipse generated php files uploaded through ftp

I have uploaded my PHP project created using Eclipse-PDT to the siteground server.
After completing the upload, i tried to run the php pages and it throws an error saying "Expected End of statement".
Then i logged in to the CPANEL and found that all the line breaks are removed from the script. since i have used "single line comments" in my php script ,its throwing error(next line will also append to the previous line)
can anybody help to solve this issue? i have a lot of php pages ,so its not possible to remove all single line comments from all the pages.
Maybe its caused by different file encoding?
Check which format is used in your editor.

Categories