Page 1 of 1

[SOLVED] php header problem

Posted: Mon Apr 04, 2005 4:59 am
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 !

Posted: Mon Apr 04, 2005 5:33 am
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...

Posted: Mon Apr 04, 2005 5:42 am
by Pyrite
I forgot to add, the problem happens in IE6 on the second server, if using Firefox, it works fine on both servers.

Posted: Mon Apr 04, 2005 5:52 am
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");

Posted: Mon Apr 04, 2005 6:03 am
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?

Posted: Mon Apr 04, 2005 7:11 am
by Pyrite
I tried out your suggestions anyways, and they make no difference.

Posted: Mon Dec 19, 2005 5:24 pm
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?