Wordpress - Headers already sent [duplicate] - php

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 8 years ago.
I just migrated a wordpress site from a local xampp server running on my Windows 8 PC to a cpanel hosting account which I use to host a few other sites.
Post migration the site seemed to be working well, until I tried saving a page in the wordpress admin. Upon saving, I encountered the error message shown further down the page.
I have attempted to troubleshoot to the best of my ability, including following the steps on the wordpress site for this particular error. So far, to no avail.
If I disable the nextgen gallery plugin, the problem goes away. I require the plugin to display images on the site though, so it's not a solution.
Interestingly enough, the changes do get saved, despite the error.
If anyone can help me figure out this problem I will be forever grateful!
Many thanks
Warning: preg_match() expects parameter 2 to be string, array given in
/home/ascothou/public_html/wp-content/plugins/nextgen-gallery/non_pope/class.photocrati_resource_manager.php
on line 36
Warning: strpos() expects parameter 1 to be string, array given in
/home/ascothou/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/admin.php on line 63  Warning: Cannot modify header information - headers
already sent by (output started at
/home/ascothou/public_html/wp-content/plugins/nextgen-gallery/non_pope/class.photocrati_resource_manager.php:1)
in
/home/ascothou/public_html/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/frame_communication/class.frame_event_publisher.php
on line 74
Warning: Cannot modify header information - headers already sent by
(output started at
/home/ascothou/public_html/wp-content/plugins/nextgen-gallery/non_pope/class.photocrati_resource_manager.php:1)
in /home/ascothou/public_html/wp-admin/post.php on line 222
Warning: Cannot modify header information - headers already sent by
(output started at
/home/ascothou/public_html/wp-content/plugins/nextgen-gallery/non_pope/class.photocrati_resource_manager.php:1)
in /home/ascothou/public_html/wp-includes/pluggable.php on line 899

2 possible reasons.
You screwed that page up, and PHP generates warnings (which you have seen), and then the warnings are printed to the browser, which prevents the headers being modified.
You saved the page with UTF-8 BOM, which is sent to browser before the header modification.
More like the 1st reason.

Related

Warning: base64_decode() has been disabled for security reasons

I'm using a WordPress site, recently I had to update my site to WordPress 4.6.2. And now I'm experiencing an error. Can anyone help me out with this? check out the image for the error message:
Warning: base64_decode() has been disabled for security reasons in
/home/play2daa/public_html/wp-content/plugins/postman-smtp/Postman/PostmanOptions.php
on line 270
Warning: base64_decode() has been disabled for security reasons in
/home/play2daa/public_html/wp-content/plugins/postman-smtp/Postman/PostmanOptions.php
on line 274
Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at
/home/play2daa/public_html/wp-content/plugins/postman-smtp/Postman/PostmanOptions.php:270)
in
/home/play2daa/public_html/wp-content/plugins/tawkto-live-chat/tawkto.php
on line 44
Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
/home/play2daa/public_html/wp-content/plugins/postman-smtp/Postman/PostmanOptions.php:270)
in
/home/play2daa/public_html/wp-content/plugins/tawkto-live-chat/tawkto.php
on line 44
Warning: Cannot modify header information - headers already sent by
(output started at
/home/play2daa/public_html/wp-content/plugins/postman-smtp/Postman/PostmanOptions.php:270)
in /home/play2daa/public_html/wp-includes/pluggable.php on line 1174
With respect, this question could be handled by reading the error messages carefully. The people who developed PHP went to a lot of trouble to make their messages informative.
The first two error messages in your question tell the story. They're pretty much the same fault.
Warning: base64_decode() has been disabled for security reasons in /home/play2daa/public_html/wp-content/plugins/postman-smtp/Postman/PostmanOptions.php on line 270
Let's parse this message.
base64_decode is a php function. Type php base64_decode into your fav search engine to learn more.
base64_decode() has been disabled for security reasons is the error message. Try typing that into a search engine to learn more.
in /home/play2daa/public_html/wp-content/plugins/postman-smtp/Postman/PostmanOptions.php on line 270 tells you where the problem occurred. Look! it says .../plugins/postman-smtp/... in the path name! It seems likely you have a WordPress plugin called Postman SMTP or maybe Postman in your WP install. Have you contacted that plugin's developer to figure out what to do?
Here's the thing: Lots of cybercriminals have figured out how to trick various WordPress plugins into running malicious code by concealing it in base-64 encoded text and uploading it. So, some cheap and nasty hosting services have blocked the PHP call that decodes that kind of text, in an attempt to slow down those miscreants.
You can fix this problem by....
getting the plugin developer to issue an update, or repairing the plugin yourself if you're a developer.
finding a different plugin to send email from your site.
getting your hosting service to re-enable this disabled function.
firing your hosting service and getting a new one.

Wordpress Warning: Cannot modify header information - wp-includes/rewrite.php :1

I am getting warning on my wordpress site:
Warning: Cannot modify header information - headers already sent by (output started at /home/content/8305169/html/wordpress/wp-includes/rewrite.php:1) in /home/content/8305169/html/wordpress/wp-includes/pluggable.php on line 1207
I am unable to access my admin panel. I tried removing extra space before starting php tag and after closing php tag but not worked for me.
EDIT:
I have two site having the same issue.
Error i am getting on my other site is:
Warning: Cannot modify header information - headers already sent by (output started at /home/content/69/8305169/html/POWER/wp-includes/shortcodes.php:1) in /home/content/69/8305169/html/POWER/wp-includes/pluggable.php on line 1207
Please suggest me what should i do.
Thanks

PHP Warning Cannot Modify Header Information [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 9 years ago.
My site is running fine on one server but when I shifted it to another server, some pages are giving following warning message.
Warning: Cannot modify header information - headers already sent by (output started at /home/parviz/public_html/ganj_videos/lang/english.php:1) in /home/parviz/public_html/ganj_videos/mobile/detect.php on line 50
Any idea on how to fix it?
Thanks.
Most likely your new server has a different setting for the errors and warnings. If PHP issues a warning or error as output then it will cause your headers to fail.
Change the level using the error_reporting function.
Just follow the debug: it says output started in file /home/parviz/public_html/ganj_videos/lang/english.php on line 1. There's most probably some messy newlines or spaces there. Make sure all php files executed start with <?php and NOTHING else before it, or you'll get the warning.

Codeigniter: Message: Cannot modify header information - headers already sent by (output started at [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 9 years ago.
I have created a dynamic menu CMS website. I developed in a Windows system. When i run my project in windows operating system, My project runs without any error. But now uploaded it into Linux Operating system server i am getting warning & error like:
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /home/ansofcm8/public_html/apps/resources/math/application/core/MY_Controller.php:1)
Filename: libraries/Session.php
Line Number: 675
What could be the reason. Please help me.
There seems to be whitespace before the php open tag <?php in MY_Controller.php.
Check all PHP files and remove the whitespace before the <?php tag. If there is a space or new line, the body of the http request is started, and you can't add new headers to the http request.

Cannot modify header information after Wordpress migration [duplicate]

This question already has answers here:
How to fix "Headers already sent" error in PHP
(11 answers)
Closed 10 years ago.
I realise this has been asked many times, and the answer is usually some whitespace before or after the PHP tags however I have checked all my files and not found any evidence of this.
I am using Wordpress and have debug mode switched on. My site works on one domain however I recently moved it to a new server (still running apache on linux - I did move from shared to a VPS) and gave it a new domain. All I have changed is the following in wp-config.php:
define('DB_NAME', 'new db name');
define('DB_USER', 'new db user');
define('DB_PASSWORD', 'new db password');
define('WP_HOME','new url');
define('WP_SITEURL','new url');
However I am now unable to log in, I have narrowed this down to the fact cookies are not being set. If I visit wp-login.php I get the following errors:
Warning: Cannot modify header information - headers already sent by (output started at /home/rcnhca/public_html/wp-includes/load.php:270) in /home/rcnhca/public_html/wp-login.php on line 368
Warning: Cannot modify header information - headers already sent by (output started at /home/rcnhca/public_html/wp-includes/load.php:270) in /home/rcnhca/public_html/wp-login.php on line 380
Note: Both wp-login.php and load.php are core Wordpress files.
line 368 of wp-login.php is:
header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));
and line 380:
setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
line 270 of load.php is:
ini_set( 'display_errors', 1 );
However I also recieve the following warning:
Warning: ini_set() has been disabled for security reasons in /home/rcnhca/public_html/wp-includes/load.php on line 270
Which I believe is because I have the Suhosin PHP patch installed but I am not definite on this. I do not want to run a more vulnerable version of PHP.
I can't work out why this error is occurring, there is no trailing whitespace in any of my theme's PHP files.
Note: I also realise I can use output buffering to solve this, however I want to understand where the problem is occurring instead of applying a one-size fits all patch which will affect my debugging capabilities.
The ini_set() warning causes the headers to get sent which in turn triggers the "cannot modify headers" messages.

Categories