Jump to content

Recommended Posts

hey guys,

 

I really need some help here. i've written a php script to download file using sockets. The file is a couple of hundred megs in size and the script is to run in the backgrond. I've added the line

 

ignore_user_abort(1);

set_time_limit(0);

 

to my script. On my machine it runs file. The file take about an hour to download and i dont have any issues. When i uploaded the php file onto my server, it began executing, downloade about 5-10% of the file and then quit. What coupd be causing this problem? Can i check what is causing my script to abort/terminate? I host with powweb.

Link to comment
https://forums.phpfreaks.com/topic/54647-php-script-aborts/
Share on other sites

It could be the time_limit but it also could be the memory limit php sets.

 

If you do not have access to php.ini to set that which I bet your host does not allow.

 

You may be SOL, but I would look into this: http://www.radinks.com/upload/config.php

 

The normal limit is about 16MBs

Link to comment
https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270235
Share on other sites

well the moment you hear what i've got to say you might say "what a !@#$head". Well, my php script also consisted of a line

 

ini_set("memory_limit", "1024M");

 

My script was based on the code of another script i found online. It had this line. I though it would have something to do with downloading a file so i let it be 1024M. Could it be the reason why it quits?

 

Is there a way i can check if my script is crashing or it is being aborted?

 

Link to comment
https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270241
Share on other sites

Don't get too upset, read his sig:

 

I give faulty code on purpose; Don't be mad......... I'm lonely.

 

Didn't think it was true till now lmfao.

 

At anyrate, you may not have "full" access to the memory_limit or even the ini_set feature via your webhost.

 

As far as telling if it is aborting or what not, there is no real way to tell. A good test would be upload a file that is 15mb's than upload one that is 17MB's see if it aborts on the either or. If it does not abort or quit on the 15 but does on the 17, it means your host disallows changing the memory_limit.

 

About the only way I can really think of to test for this sort of thing.

Link to comment
https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270247
Share on other sites

hey frost. When you refer to memory limit you are referring to the amount of RAM allocated right? Okay, when i use sockets to download a file, i keep writing the contents to a file in 4kb chunks, does it still occupy memory? i guess 16M for a normal script is enough.

 

 

my webhost allows us to customise out php.ini. I have options in my control panel.

 

 

Another thing, how do i execute my script using the system() or exec() command. where is the PHP executable located, what parameters should i pass? I just want to try this- might just work.

Link to comment
https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270260
Share on other sites

hey frost. I dont think my script is aborting due to memory limitations. I tried downloading some files using cURL (150megs in size) and t hey all downloaded flawlessly. Am i missing something here?

 

Aslo could someone give me a the code to execute a php script from the command line using the exec, system, passthru or one of those commands. I cant seem to figure it out.

Link to comment
https://forums.phpfreaks.com/topic/54647-php-script-aborts/#findComment-270506
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.