[SOLVED] php header problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

[SOLVED] php header problem

Post by Pyrite »

Hi, I've got two servers. And this script generates a windows .reg file and sends it to the browser to download. One my dev server everything works great, but my other server, it doesn't send the right filename.

Code: Select all

header("Content-Type:misc/regfile");
header("Content-Disposition: inline; filename=IBS_Dev_News_Account.reg");
It should send IBS_Dev_News_Account.reg, but on the second server it sends genreg.php (which is the name of script that generates the reg file). Any ideas? Both servers are Win32 running Apache 2.0.x and PHP 4.3.10.

*NOTE* I fixed this by turning mod_deflate off in Apache !
Last edited by Pyrite on Mon Apr 04, 2005 7:45 am, edited 2 times in total.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Try adding a forward slash after the .php part of the url.

genreg.php/?arguments=values

Netscape 7.1 used to have similar problems from what I can rememebr and that was the fix for it :wink:

Might work, might not...
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

I forgot to add, the problem happens in IE6 on the second server, if using Firefox, it works fine on both servers.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Pyrite wrote:I forgot to add, the problem happens in IE6 on the second server, if using Firefox, it works fine on both servers.
Did it make a difference in any case? At the very least it should make it put no filename at all in there, at best it will use the one you specify.

What happens with these headers instead?

Code: Select all

header("Content-Type: application/regfile"); //Try 'application/octet-stream' too
header("Content-Disposition: attachment; filename=IBS_Dev_News_Account.reg");
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

I haven't tried, I am convinced the problem is not with the code, but rather the configuration of either php.ini (most likely) or httpd.conf . It is not a code problem I know that for sure, unless it is syntatically incorrect.

I guess what I'm asking is what settings in php.ini affect the usage and effect of the header() function?
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

I tried out your suggestions anyways, and they make no difference.
User avatar
shoebappa
Forum Contributor
Posts: 158
Joined: Mon Jul 11, 2005 9:14 pm
Location: Norfolk, VA

Post by shoebappa »

I've run into this problem with the filename being named the php file, and agree that it's mod_deflate. Does anyone have a solution to turn off deflate for just this purpose, and not all together?
Post Reply