« Previous Next »

Thread: PHP EXCEL EXPORT error!!

Last post 09-28-2009 2:05 PM by don.raman. 15 replies.

Average Rating Rate It (5)

RSS

Page 1 of 2 (16 items) 1 2 Next >

Sort Posts:

  • 09-28-2009, 11:32 AM

    • gvardan
    • Not Ranked
    • Joined on 09-28-2009, 3:20 PM
    • Posts 10

    PHP EXCEL EXPORT error!!

     Hi,

    We just moved all our php based web applications to windows server running IIS 6.0.
    Exporting to Excel function is unfortunately not working in the applications only in Internet Explorer.
    I believe its something to do with IIS MIME types after i went through some forums. I set the MIME type for .xls and .xla as application/vnd.ms-excel in IIS.
    But still I'm getting error attached below..

    This is my header details in php

        header("Content-Disposition: attachment;filename=QueryExport-NRBN".date("Y-m-d_hms").".xls");
        header("Content-Type = application/download");
        header("Content-Transfer-Encoding: binary");
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header("Expires: 0"); 

    i hope someone can help me out.

    Thank you,

     

  • 09-28-2009, 11:56 AM In reply to

    Re: PHP EXCEL EXPORT error!!

    I understand that it is working properly on other browsers like Firefox. If that's the case maybe the problem is with Internet Explorer. I am no expert in this area but you can try reading these forum posts and see if this is of any help:

    Let's hope someone else will be able to help you more. I am sorry but I can do only this much now.

    Thanks,

    Don.

  • 09-28-2009, 12:09 PM In reply to

    • gvardan
    • Not Ranked
    • Joined on 09-28-2009, 3:20 PM
    • Posts 10

    Re: PHP EXCEL EXPORT error!!

    Thank you for your suggestions,

    I gave those a try no luck yet, but my issue is somewhat smiler to that. we have SSL certificate enabled.

    Basically IE is trying open the php script file rather than the excel file, which i dont understand..

    Anyhow everything was working fine when it was in UNIX server, even IE never gave any trouble. only after we moved IIS 6.0.

  • 09-28-2009, 12:22 PM In reply to

    Re: PHP EXCEL EXPORT error!!

    Let's try to understand this bit more before blaming Windows/IIS. If this is a genuine problem with IIS, we will definitely address it. All the web servers work differently so expecting that a simple move from one server to another will work might be false. I am not trying to sell IIS here but just wanted to state facts.

    I would like to know more detail about IE trying to open the PHP file rather than Excel. This means actually the PHP file should have been run and as a result of execution IE should try to open an Excel Sheet. Right? Did you try any other browser like FireFox and see what the result is? Typically this happens if you are using short tags in the PHP code and your short tags is disabled in PHP.INI file. See http://us.php.net/manual/en/ini.core.php for details on this INI directive. But if this is the case it should not have worked on FireFox too. More details please. One more question I am expecting that your simple PHP pages are working fine. Right?

    Thanks,

    Don.

  • 09-28-2009, 12:41 PM In reply to

    • gvardan
    • Not Ranked
    • Joined on 09-28-2009, 3:20 PM
    • Posts 10

    Re: PHP EXCEL EXPORT error!!

    Well I'm not blaming the windows/IIS,we have our reasons for choosing IIS. Also this is not a simple server move/plan,actually we have been working on this for last 8 months. Most of the applications were custom built, we took our time to fix all the problems we encountered and make all the scripts work with IIS.
    It was tested for about a month, but never had this issue. I just realized that during the testing period we dint have the SSL enabled. And yes as you said it works fine in Firefox and other browsers, only we having trouble with internet explorer (7 and 8)..

  • 09-28-2009, 12:44 PM In reply to

    • gvardan
    • Not Ranked
    • Joined on 09-28-2009, 3:20 PM
    • Posts 10

    Re: PHP EXCEL EXPORT error!!

    Ohh yea, when i open the file in internet explorer rather than saving it, it shows all the data in the browser. But firebox and other browsers open it properly in excel.

  • 09-28-2009, 12:47 PM In reply to

    Re: PHP EXCEL EXPORT error!!

    So if my understanding is corect:

    • In FireFox everything works correct
    • The PHP page is responsible for downloading Excel sheet
    • Internet Explorer is not even allowing to execute the PHP page rather downloading the page itself.
    • Is the problem happening with all versions of Internet Explorer? I mean IE6/IE7/IE8.

    Can you exactly tell me what all workarounds you have tried.

    Thanks,

    Don.

  • 09-28-2009, 12:51 PM In reply to

    Re: PHP EXCEL EXPORT error!!

    gvardan:
    Ohh yea, when i open the file in internet explorer rather than saving it, it shows all the data in the browser.

    Can you paste an image how it looks like in IE?

    Thanks,

    Don.

  • 09-28-2009, 12:57 PM In reply to

    • gvardan
    • Not Ranked
    • Joined on 09-28-2009, 3:20 PM
    • Posts 10

    Re: PHP EXCEL EXPORT error!!

    don.raman:

    gvardan:
    Ohh yea, when i open the file in internet explorer rather than saving it, it shows all the data in the browser.

    Can you paste an image how it looks like in IE?

    Thanks,

    Don.

     

     

  • 09-28-2009, 1:09 PM In reply to

    • gvardan
    • Not Ranked
    • Joined on 09-28-2009, 3:20 PM
    • Posts 10

    Re: PHP EXCEL EXPORT error!!

    don.raman:

    So if my understanding is corect:

    • In FireFox everything works correct
    • The PHP page is responsible for downloading Excel sheet
    • Internet Explorer is not even allowing to execute the PHP page rather downloading the page itself.
    • Is the problem happening with all versions of Internet Explorer? I mean IE6/IE7/IE8.

    Can you exactly tell me what all workarounds you have tried.

    Thanks,

    Don.



    Well we have tested only in IE 7.0 and 8.0, other than that everything else you have said above is true..

    So far,
    *we tried changing the MIME type for .xls to "text/plain" and "application/vnd.ms-excel";
    *changed the headers in the scripts as mentioned in few other forums;
    *and as mentioned in one of your link suggestions we enabled the "Do not save encrypted page to disk"  in the advance tab.
    Its giving the same error.

    Once again i would like to point out that we dint have this issue when we tested it without SSL enabled. Its only after we put the application in production with SSL certificate enabled.

  • 09-28-2009, 1:16 PM In reply to

    Re: PHP EXCEL EXPORT error!!

    Seems like IE is broken or to the least not behaving like other browser. Try these and let me also know what all you have already tried:

    Thanks,

    Don.

  • 09-28-2009, 1:25 PM In reply to

    Re: PHP EXCEL EXPORT error!!

    This should solve your problem.

    http://support.microsoft.com/kb/316431

    Thanks,

    Don.

  • 09-28-2009, 1:31 PM In reply to

    • gvardan
    • Not Ranked
    • Joined on 09-28-2009, 3:20 PM
    • Posts 10

    Re: PHP EXCEL EXPORT error!!

    well we are experiencing this in all the users PC, so its not specific for one browser..
    An yea i tried both of the options you mentioned..
    I wonder how it was working well without SSL.

  • 09-28-2009, 1:32 PM In reply to

    • gvardan
    • Not Ranked
    • Joined on 09-28-2009, 3:20 PM
    • Posts 10

    Re: PHP EXCEL EXPORT error!!

    don.raman:

    This should solve your problem.

    http://support.microsoft.com/kb/316431

    Thanks,

    Don.

     

     

    let me try this.. :) hope it works..

  • 09-28-2009, 2:02 PM In reply to

    • gvardan
    • Not Ranked
    • Joined on 09-28-2009, 3:20 PM
    • Posts 10

    Re: PHP EXCEL EXPORT error!!

     Hey,

    I really appreciate your  help, thanks a lot for pointing me to the right direction.
    I changed the header as mentioned in this site http://www.activecollab.com/forums/topic/903/, and its all working fine now..

    Thank you so much.

Page 1 of 2 (16 items) 1 2 Next >
Microsoft Communities