• Hello,
    I have a wordpress site with a members area. Members can download zipped files of images or video by clicking on a link. The files are in a directory above the public_html directory. The files are served through a php script that purports to locate them in a directory in the public_html called “downloads”. But “downloads” is actually merely a wordpress page that links to the php script that calls the files from their true location. Thus the true path is hidden making the files more secure.In fact this php is contained in a plugin called “hide-real-download-path”. No longer supported or updated for a long time. But still, it’s not complicated and it used to work well. But following, it seems to me, a recent wordpress update, files now time out after 4 minutes. And so files in exess of around 25 – 30 mb fail to download.

    The code includes the line
    set_time_limit(0);
    which ought by rights to keep the script open until completion.

    I tried a different 4 line php script to force download without he location obscuring feature and that also timed out.

    However, a straightforward entry of the path if the folder is placed below public-html allows the file to be downloaded completely

    I’ve tried messing around with .htaccess code and wp-config code and user.ini code to extend php script execution time but haven’t found a solution.

    The site is hosted on Godaddy shared hosting with level 3 resources. They say that they aren’t limiting the script execution time.

    Anyone have any ideas what I should do to offer these files as downloads without publishing their address?

    Has something changed in the latest version of WordPress to affect script execution times.?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Some hosting providers force terminate a script after certain minutes under a shared hosting plan.

    Try upgrading to a VPN / Dedicated plan.

    @bill7473: There is no reason at this point to go to a bigger server. See https://www.godaddy.com/help/php-upload-limits-on-shared-hosting-1475 to check/change your upload limits in your php.ini file. The php.ini file should override the timeout in the plugin. You’re able to directly download the file from another folder because the plugin isn’t in the php execution loop.

    If needed, you can also change the timeout itself with

    max_execution_time = 120

    on the same php.ini file, but try the upload limit first. GoDaddy may globally limit the actual timeout when they don’t limit the download size.

    Thread Starter bill7473

    (@bill7473)

    Thank you Mark and Rajesh for your replies. I’m astonished that 2 months have passed since I posted this. With Godaddy shared hosting it isn’t possible to directly access the php.ini file. However via C Panel > Software > Select PHP version > Switch to PHP options you can enter a value for max_execution_time.

    I wasn’t able however to solve my problem so I resorted, until I find a better solution, to putting the zip files in a folder below public_html and providing direct links, which isn’t very secure but does at least work. I limited access to the folder so no one can list its contents and gave the zips long obscure alpha-numeric file names so they can’t be easily guessed.

    Anyway I wanted to thank you for your advice and also, in case anyone else needs to search for the php.ini file with a Godaddy hosted site. That’s where it is. I had to call em to find out.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘php script execution time, downloads timing out’ is closed to new replies.