jeffery1493 Posted November 10, 2009 Share Posted November 10, 2009 Hi All, :'( I just moved over to a new server hosting company, and brought my heavily modified load of programs and applications over to the new site. What was my surprise when the programs ground to a screeching halt, and everything bombed out left and right with whitespace errors like this: Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/phpbb/includes/sessions.php:626) in /home/maydayle/public_html/phpbb/includes/sessions.php on line 278 Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/phpbb/includes/sessions.php:626) in /home/maydayle/public_html/phpbb/includes/sessions.php on line 279 Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/phpbb/includes/sessions.php:626) in /home/maydayle/public_html/phpbb/lwbbdeposit.php on line 31 I talked to my hosting company who informed me that they use PHP version 5, and my old hosting company had version 4.3.2. Apparently, in Version 5 the programmers decided to change around the way cookies are set and header statements are used, or to disallow the way things worked before, so basically any line starting with "Header" bombs with the "Headers already sent" message, and perhaps more must be done to get the thing working again. They told me I was not allowed to "downgrade" either Is there some kind of doable fix for this? I've heard talk about using ob_start and ob_flush statements, but that doesn't work. As of now, my move to the new hosting company has resulted in complete downtime. Thanks for any help or advice. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/ Share on other sites More sharing options...
Gayner Posted November 10, 2009 Share Posted November 10, 2009 Is there a way u can just email them and ask them to switch back ? lol Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954482 Share on other sites More sharing options...
mrMarcus Posted November 10, 2009 Share Posted November 10, 2009 BLAM!!! grab some coffee and tape those eyelids up. just read up on the header() function, and read this thread. it's really not that bad .. you just can't have anything parsed to the browser before any headers are sent. no whitespace, no HTML, no nothing. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954485 Share on other sites More sharing options...
jeffery1493 Posted November 10, 2009 Author Share Posted November 10, 2009 I've seen that response too while looking this up (I've been working with this ever since I moved over, but didn't know it was because of the PHP version change until today), except this application is PHPBB and the writers used Header statements all over the place....... top, bottom, in subroutines, here, there everywhere. How in the world am I supposed to put them all at the beginning of each program? that simply wont work. As far as removing the whitespace, I've tried that already, it seems to make no difference. Can I ring their necks (www.php.net)? I guess that's not an option...... Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954487 Share on other sites More sharing options...
jeffery1493 Posted November 10, 2009 Author Share Posted November 10, 2009 There might be something in http://php.net/manual/en/function.header.php I'll try again tonight. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954489 Share on other sites More sharing options...
Dorky Posted November 10, 2009 Share Posted November 10, 2009 BLAM!!! grab some coffee and tape those eyelids up.lmfao Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954490 Share on other sites More sharing options...
PFMaBiSmAd Posted November 10, 2009 Share Posted November 10, 2009 The problem has absolutely nothing to do with the php version. Your old web hosting had output_buffering turned on in the php.ini, which allowed you write some code that managed to function. A quick fix, while you are rewriting the code to be correct, would be to turn output_buffering on in a local php.ini (when php is running as a CGI application) or in a .htaccess file (when php is running as an Apache module.) By the way, your web host should have published exactly which php.ini settings they were going to change between the old and new hosting they were offering so that someone would know before hand what they would need to be updating in their scripts. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954496 Share on other sites More sharing options...
jeffery1493 Posted November 10, 2009 Author Share Posted November 10, 2009 >> The problem has absolutely nothing to do with the php version. Your old web hosting had output_buffering turned on in the php.ini, which allowed you write some code that managed to function. >> Thanks- That could be the case... in fact I was actually just trying to look at that output buffering setting when I came back. But unfortunately these people have secured php.ini so I can't even read it. They have a programmer on site who claims it to be the PHP version, says that PHP version 5 is 'less forgiving with code constructs'. The file appears to be there, /root/lib/php.ini, but when I try to vi it I get nothing. If its some kind of special linux file that is uneditable, then I'm none the wiser. As far as web hosting companies, the last one (who shall remain nameless) did a server upgrade and not only wiped out two weeks of my work, but now the application won't even run at all there at all. So I packed up my bags and ran for the hills. So I'm fleeing from the pan into the fire, apparently! I never wrote this code, it is code the PHPBB people wrote. At least all the programs its complaining about, sessions.php, functions.php, etc. God help me if I have to upgrade PHPBB. All I wanted to do was just have the darned thing work as is............ I have gleaned over all of these looking for extra spaces, etc., etc, put buffer flushes in, taken them out, for days on end. It seems (I have no idea why) some disappeared when I replaced "header" with "Header". I didn't know about the .htaccess file, maybe that? Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954573 Share on other sites More sharing options...
PFMaBiSmAd Posted November 10, 2009 Share Posted November 10, 2009 Migrating from PHP 4 to PHP 5 Although PHP 5 offers many new features, it's designed to be as compatible with earlier versions of PHP as possible with little functionality being broken in the process. Whatever programmer told you that php5 was less forgiving does not know what he is saying. There are very few incompatible changes going from php4 to php5 that are due to actual language changes. Most problems with old code are due to programmers not following recommend php.ini settings, in some cases using depreciated features that were turned off over 7 years ago. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954577 Share on other sites More sharing options...
jeffery1493 Posted November 10, 2009 Author Share Posted November 10, 2009 Well I can't edit php.ini, and never changed the language of the code either. Its just plain old ordinary code from PHPBB, unedited. So I can't figure out why now it doesn't work. I wasn't sure if it would work, but what the heck..... I tried adding these lines to my .htaccess file: # Use PHP5 as default AddHandler application/x-httpd-php5 .php # php_value output_buffering On # php_value output_handler mb_output_handler ~ And I got (on entering the main forum web page, phpbb): ob_start(); ob_flush(); ob_start(); Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/phpbb/includes/sessions.php:2) in /home/maydayle/public_html/phpbb/includes/sessions.php on line 278 Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/phpbb/includes/sessions.php:2) in /home/maydayle/public_html/phpbb/includes/sessions.php on line 279 Then I clicked NEW TOPIC and was treated to: ob_start(); ob_flush(); ob_start(); Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/phpbb/includes/sessions.php:2) in /home/maydayle/public_html/phpbb/includes/functions.php on line 53 The sessions and functions headers errors are all standard fare again. I also tried moving the header functions all to the top of the file in every program, just for the heck of it.........no difference. It appears adding the flush, if it possible in .htaccess, must have # signs to "work" and that results in it displaying the words, 'ob_start(); ob_flush(); ob_start();' on every page. If that means its actually flushing, then I'm flushed. I really don't think I have the capacity and know-how to rewrite PHPBB's code.....and I don't really want to start going down that road. Surely there must be some way just to get their old code to work again as is, just like it did on the other server.............as they say in some coding circles, if it already works, why should you have to fix it. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954579 Share on other sites More sharing options...
Philip Posted November 10, 2009 Share Posted November 10, 2009 Open up /phpbb/includes/sessions.php and look at lines 1 & 2. That's sending your ouput. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954590 Share on other sites More sharing options...
jeffery1493 Posted November 10, 2009 Author Share Posted November 10, 2009 The beginning of my sessions.php file: <?php /*************************************************************************** * sessions.php * ------------------- * begin : Saturday, Feb 13, 2001 * copyright : © 2001 The phpBB Group * email : support@phpbb.com * * $Id: sessions.php,v 1.1.1.1 2006/08/01 10:34:11 andrei Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ // Nothing has changed since I first loaded it. As far as output buffering- I talked to my server support people again, they said that I did have a php.ini file, but it somehow had gotten deleted. I never noticed it there before. Anyway they put it in public_html/php.ini. There is also a /root/lib/php.ini but they say that is the uneditable one and mine is for customizations. I checked my old server and yes it did have output buffering on: output_buffering = 4096 ; Performance So I made the same change on the new server in the editable php.ini file. I logged out and back in, and still on the main page: Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/fish4tips.com/phpbb/includes/sessions.php:626) in /home/maydayle/public_html/fish4tips.com/phpbb/includes/sessions.php on line 278 Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/fish4tips.com/phpbb/includes/sessions.php:626) in /home/maydayle/public_html/fish4tips.com/phpbb/includes/sessions.php on line 279 it doesn't seem to have made any difference! Very frustating. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954599 Share on other sites More sharing options...
jeffery1493 Posted November 10, 2009 Author Share Posted November 10, 2009 If I try to log in, I just get a blank white screen: Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/fish4tips.com/phpbb/includes/sessions.php:626) in /home/maydayle/public_html/fish4tips.com/phpbb/includes/sessions.php on line 278 Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/fish4tips.com/phpbb/includes/sessions.php:626) in /home/maydayle/public_html/fish4tips.com/phpbb/includes/sessions.php on line 279 Warning: Cannot modify header information - headers already sent by (output started at /home/maydayle/public_html/fish4tips.com/phpbb/includes/sessions.php:626) in /home/maydayle/public_html/fish4tips.com/phpbb/includes/functions.php on line 973 Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954600 Share on other sites More sharing options...
jeffery1493 Posted November 10, 2009 Author Share Posted November 10, 2009 Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954603 Share on other sites More sharing options...
jeffery1493 Posted November 10, 2009 Author Share Posted November 10, 2009 Wait----------hold the phone------------------ The header error messages are starting to disappear now that the buffer change was made. I don't know maybe it just takes awhile. still testing........... Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954612 Share on other sites More sharing options...
jeffery1493 Posted November 10, 2009 Author Share Posted November 10, 2009 SLAMM!!!!!! It looks like its fixed. RE: setting output_buffering = 4096 in the php.ini file. As far as writing the code better, I'm sure it should be done, but I'll leave that to the writers. THANKS FOLKS!!!! And I'll take back what I said about PHP5. I think what I am dealing with, is a server company who likes to pass the buck! Too bad they never pass mine back. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954613 Share on other sites More sharing options...
Dorky Posted November 10, 2009 Share Posted November 10, 2009 be on the lookout for some changes in the gd lib if you use it. imagecreate quality is no longer 1-100 but 1-10 now. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954618 Share on other sites More sharing options...
trq Posted November 10, 2009 Share Posted November 10, 2009 It looks like its fixed. It might look that way, but its not. Its just hidden. If that were a car I would recommend getting rid of it before it kills you or someone else in your family. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954625 Share on other sites More sharing options...
PugJr Posted November 10, 2009 Share Posted November 10, 2009 It looks like its fixed. It might look that way, but its not. Its just hidden. If that were a car I would recommend getting rid of it before it kills you or someone else in your family. Wouldn't the method he took just be less effective? Not harmful? Eg. Car example would be that there is a small dribble of gasoline leaking from the car. (This is a world where gasoline doesn't ignite on fire and explode.) Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954629 Share on other sites More sharing options...
trq Posted November 10, 2009 Share Posted November 10, 2009 Its not so much the method in question but the quality of the code in the first place that worries me. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954668 Share on other sites More sharing options...
keldorn Posted November 10, 2009 Share Posted November 10, 2009 The problem has absolutely nothing to do with the php version. Your old web hosting had output_buffering turned on in the php.ini, which allowed you write some code that managed to function. I believe this is called programming by coincidence. Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954673 Share on other sites More sharing options...
gizmola Posted November 10, 2009 Share Posted November 10, 2009 So, what is the OS of the current server and what was the OS of the old server? Is it possible you moved files back and forth from unix to windows? This smells a bit like a line ending issue or something of that ilk. Can you shell into your new server and open the session file with vi and make sure there's not something odd in there? Quote Link to comment https://forums.phpfreaks.com/topic/180923-slam-new-php-version-and-now-nothing-works/#findComment-954676 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.