Jump to content

SLAM!!! New PHP version and now nothing works


jeffery1493

Recommended Posts

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.

 

Link to comment
Share on other sites

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......

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

>>

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?

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

:shrug:

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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. 

 

 

:birthday:    :birthday:      :psychic:

 

 

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.

 

 

Link to comment
Share on other sites

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.)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.