PHP file download error in Internet Explorer 7

When trying to download a file that is auto-generated on the fly by a PHP script I wrote that sends excel headers, Internet Explorer users were getting the error:

Windows Internet Explorer
Internet Explorer cannot download [filename] from [website].
Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.

This is caused by doing a session_start(). If you don't actually need a the session in your php file you can remove it, and IE users will be able to download whatever your PHP script is making. The problem is session_start() by default sends a cache control header including "no-store". Internet Explorer has a bug with sending a cache header.

If you need the session, then before session_start(), add "session_cache_limiter('none');"

Problem solved!

1 thought on “PHP file download error in Internet Explorer 7

  1. Agustin

    Hello!
    finally and after searching in several web sites… your solution fixed the issue. But to let anyone know, I was not using any session_start() in my script but IE8 keep giving the download error… I have added the session_cache_limiter line at the very first line of my php code… and worked!!!
    Best Regards and thanks!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.