Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP v4.3.1 Problems

Status
Not open for further replies.

4x4uk

Technical User
Apr 30, 2002
381
GB
My webserver has just been upgraded with PHP4.3.1
now in a few of my scripts where I have used

header("location:
I get the following errors

Warning: Cannot modify header information - headers already sent by (output started at /mnt/mss-1/vol4/web/n/ne/ne4/ in /mnt/mss-1/vol4/web/n/ne/ne4/ on line 19

anyone any ideas what is causing the problem as everything worked fine with the previous version of php
Thanks
Ian

Infinity exists! - I just haven't worked out a way to get there yet.

| |
 
ne4x4,

All this means is that something was sent in line 19 of the script indicated.
This could be due to different error reporting settings in your PHP installation.
The
Code:
header()
command has to be the first thing sent to the browser in order to redirect.

Check line 19 in the offending script and see what's being output.
You can also use output buffering to catch all the output before the header command if you can't get rid of the offending output - which is the better choice anyway.
 
DRJ478
Many thanks for the response, I will look at the two scripts and should be able to resolve the problem. I fixed most of the other ones which occured since the upgrade some were silly mistakes like
$_POST[varname] which worked with version 4.2 changed to
$_POST['varname'] for version 4.3
I will probably contact the webhost also as I don't seem to be able to get
session_start() to work anymore and this simple count sript no longer works
<?
### IMAGE FORMAT
$format = &quot;.gif&quot;;

#######################################
## (C) 2000 Total Eclipse Scripts
#
### This script is free for personal
### or commercial use.
#
# problems? scripts@tescripts.net
#######################################

$file = file(&quot;count.txt&quot;);
$num = ($file[0] + 1);
exec(&quot;echo $num > count.txt&quot;);
switch($type) {
case &quot;text&quot;:
echo $num;
break;
case &quot;gfx&quot;:
$i = 0;
$cntn = strlen($num);
while($i < $cntn) {
$tmpnum = substr($num, $i, 1);
echo(&quot;<img width=16 height=22 hspace=0 vspace=0 border=0 align=top src=\&quot;$dir/$tmpnum$format\&quot;>&quot;);
$i++;
}
break;
case &quot;q&quot;:
break;
default:
echo(&quot;count.php <b>error</b> : type not specified.&quot;);
break;
}
?>
Thanks
Ian

Infinity exists! - I just haven't worked out a way to get there yet.

| |
 
Where did you get the variable $type assign?
The codes are not complete.
I can't make a guess.
Did you turn on the register_global?
A lot of times the header error comes because you print something before the session_start().
Sorry can't help much.

--
Mike FN
&quot;8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Web Programmer.&quot;
 
Hi mikefn

sorry about the missing variables I somehow managed to delete them form the post. They are were at the top of the script.
$type = &quot;gfx&quot;;
$dir = &quot;Gifs&quot;;

The reason the above script stopped working appears to be the following line

exec(&quot;echo $num > count.txt&quot;);

I replaced the above line with

$fd = @fopen(&quot;count.txt&quot;,&quot;r+&quot;);
fputs($fd,&quot;$num&quot;);
fclose($fd);


Fixed all but a couple of minor problems now.
Many thanks
regards
Ian

Infinity exists! - I just haven't worked out a way to get there yet.

| |
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top