SolveErrors
PHP

What is session_start() really doing on my local?

6 views

(sorry for my English )
INDEX.PHP
Code:
download a.txt


TEST.PHP
PHP Code:
?session_start();

??
header('Content-Disposition:?attachment;?filename="a.txt"');
??
header('Content-Type:?text/plain;?charset=utf-8');

echo?
"Hi?devshed!";?


The Problem:
(problem occurs in IE)
--(LOCALHOST : Apache2Triad 1.5.3 : Php 5.1.2) --
I enter to index.php i click the link... Download File Dialog comes (on IE). I'm saving the a.txt (clicked 'save'). It works. (OK)

I don't click 'save' on download dialog. I click 'Open File'. Notepad opens. And makes this error:

"...\Temporary Internet Files\Content.IE5\...\a.txt File Not found. Do you want to create a new file ? (yes/no)"

It means IE can't save the file to temp dir. But on download dialog, size of the file is true. i think it buffers and outputs correctly. I get this error (open file option on IE download window) with pdf, doc etc.

--SERVER on INTERNET. Php 5.1.2 --
I click 'Open' option on IE file download dialog. IE saves the file to temporary dir successfully and opens "a.txt" with Notepad (default viewer)... Problem doesn't occur on server.


On my local server, when i delete "session_start();" , 'open' command on IE file save dialog works very well.

When i put session_start(); on my local page, IE doesn't find temporarily saved page on temporary Internet files..

Do you have an idea about why session_start() makes a problem???!?

thanks.
ahmet alp balkan - web developer

More PHP fixes

PHP-General - Header tag not directing to specified pageHow to cut down the size of a URL?index.php wont load index.html will loadWarning: oci_free_statement(): 3 is not a valid oci8 statement resourcePage 2 - str_replacePHP-General - Variabses wont load