SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strange Issue : PHP script offering PHP file to downlaod

    Hi

    I have written a script that scrap a website and extract some data.

    Script runs and start storing data in the database. but after some time, it offers the same page to download. Like it shows the SAVE AS dialog with PHP file.

    Like the script is zeetest.php and i run it like this :

    www.mysite.com/zeetest.php

    it start running, and then a SAVE FILE DIALOG appears with zeetest.php file there to be downloaded.

    please guide

  2. #2
    SitePoint Member captaincarne's Avatar
    Join Date
    Dec 2008
    Location
    Las Vegas, NV
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post the code?

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2008
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the mime types. If you have a .htaccess file in your DocumentRoot folder or in the current folder check it to see if there are any AddType directives. Try temporarily renaming your .htaccess file to something else and see if the problem persists.
    CanisHosting - Web Hosting plans starting at $3.95 per month

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does the script ever print something out? If you actually save the file, is there anything in the file?

    I've noticed this to occur on pages that timeout, especially on sites that are overloaded. However, I've never had to diagnose the problem so I never figured out why it occurred.

    Try installing a packet sniffer or something like HttpFox. Get all the data that gets exchanged and post it here.

  5. #5
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

    thanks a lot you all wrote good points.

    Thanks sk89q, i think you are 100% correct as the script is lengthy, and does not print anything and upon completion it should just redirect to some other page. But it never completes as about after few minutes, it just offer the same file to be downloaded.

    Actually, i have a main page, with a link to a file and that file has a redirection link to this script that grabs information from other website. and then at the end, this script has a redirection code to redirect to another page.

    If i put anything for the output on this page, it never outputs as it has CURLs and it start CURLs thing and never echo anything. May be due to server congestion.

  6. #6
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, you should get HttpFox and see what is being sent over HTTP. While I've noticed that correlation, I don't see why a file download dialog would initiate. It should just time out and do nothing.

    However, to fix your problem, you should print out small packets of data periodically. I assume that that is the reason. You will have to rely on another way to redirect (other than using a header), but it will keep the browser from timing out the request.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •