Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7668009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:14:54+00:00 2026-05-31T15:14:54+00:00

I have a script that looks up a file in a mysql database, sends

  • 0

I have a script that looks up a file in a mysql database, sends out some headers, names the file something human-readable, and then delivers it the the user.

It was working for about six months (for thousands of users), until about 6 hours ago.
Now, Windows 7 users now get an error that says “Windows can not open the folder. The Compressed (zipped) Folder: ‘…filename.zip’ is invalid.” This happens regardless of browser used to download. Linux users, etc., can open the delivered files just fine, and so can Win7 users if they have, say, WinRAR. Only Windows Explorer can’t open them.

Here’s where it gets really weird… if I make a new copy of my script and remove the various includes that look up the files and decide what to name it, it will download and open just fine… the resulting files from both scripts are identically sized and the resulting name is identical. [Hardcoding the new name into the original script does not help. I kind of thought it might be an encoding issue in the name.] I have tried with a few different zip files with different contents created on different machines by different methods.

The script checks for headers_sent(), file_exists(), and is_readable().

apache_setenv('no-gzip', '1'); was added to the scripts (with no effect) following the only semi-relevant info I could find here or elsewhere on the internet.

Clearly, something in the includes is breaking things somehow, but I haven’t any idea what to look for… Ideas? (There are about 300 lines of code in the includes… basically, it’s an abstract class for database access, a concrete version of that class for the files and all of their cms info, associated images for the site, etc.)

On a whim, I added “ob_clean(); right before the readfile($file);… it fixed it. So my question now, is: why? Error reporting is off in all of the files. What else could send output but not headers? And why the “sudden” change in behaivor?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:14:56+00:00Added an answer on May 31, 2026 at 3:14 pm

    Major Issue

    Have seen this error before and took me time to identify the issues because sometimes its says Header already sent and sometimes it does not.

    Here is what i found out :

    ob_clean works when you discards the contents of the output buffer but if you use ob_ get_ contents before calling ob_clean you would would see the content causing the error

    To output this information make sure you use var_dump

    Some other errors

    If there is a space (" " or " \n" or "\t") after calling the ?> tag i often get errors that can only be resolved by ob_clean

    Open your script look for script that has more lines of empty space after the ?> close tag

    Conclusion

    I think there is an empty space included in your script you are not seeing and when you copy it .. you are not copying the script but not the spaces that is why it works elsewhere

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some PHP script querying a mysql database and echoing out a piece
I have a script that looks like this #!/bin/bash function something() { echo hello
I have an IronPython script that looks for current running processes using WMI. The
I have a script that I'd like to continue using, but it looks like
I have a simple test bash script which looks like that: #!/bin/bash cmd=rsync -rv
I have a lot of Perl scripts that looks something like the following. What
I have a php script that runs a mysql query, then loops the result,
On a webserver, I have a php script that parses a .sql file (which
I have a script that takes a key from $_GET['key'] , looks up the
I have a file that contains SQL commands for the creation of a database.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.